This commit is contained in:
James Cole 2020-12-30 19:25:02 +01:00
parent ef42d89d55
commit fc4f35d6ba

View File

@ -34,7 +34,7 @@ use Log;
class UserTransformer extends AbstractTransformer
{
/** @var UserRepositoryInterface */
private $repository;
private UserRepositoryInterface $repository;
/**
* Transform user.
@ -45,6 +45,7 @@ class UserTransformer extends AbstractTransformer
*/
public function transform(User $user): array
{
$this->repository = $this->repository ?? app(UserRepositoryInterface::class);
return [
'id' => (int)$user->id,
'created_at' => $user->created_at->toAtomString(),