From fc4f35d6baa2e30a5d6de63190084b5485c1448d Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 30 Dec 2020 19:25:02 +0100 Subject: [PATCH] Fix #4195 --- app/Transformers/UserTransformer.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Transformers/UserTransformer.php b/app/Transformers/UserTransformer.php index 3bd96346f4..5d10e45b42 100644 --- a/app/Transformers/UserTransformer.php +++ b/app/Transformers/UserTransformer.php @@ -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(),