diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php index d3c9e0ad22..ffd61461e4 100644 --- a/app/Repositories/Category/CategoryRepository.php +++ b/app/Repositories/Category/CategoryRepository.php @@ -267,6 +267,7 @@ class CategoryRepository implements CategoryRepositoryInterface { /** @var CategoryUpdateService $service */ $service = app(CategoryUpdateService::class); + $service->setUser($this->user); return $service->update($category, $data); } diff --git a/app/Services/Internal/Update/CategoryUpdateService.php b/app/Services/Internal/Update/CategoryUpdateService.php index f7eeaa2222..205ef72b00 100644 --- a/app/Services/Internal/Update/CategoryUpdateService.php +++ b/app/Services/Internal/Update/CategoryUpdateService.php @@ -35,6 +35,9 @@ use Log; */ class CategoryUpdateService { + private $user; + + /** * Constructor. */ @@ -43,6 +46,9 @@ class CategoryUpdateService if ('testing' === config('app.env')) { Log::warning(sprintf('%s should not be instantiated in the TEST environment!', get_class($this))); } + if(auth()->check()) { + $this->user = auth()->user(); + } } /** @@ -106,4 +112,12 @@ class CategoryUpdateService } } + /** + * @param mixed $user + */ + public function setUser($user): void + { + $this->user = $user; + } + }