registerRepository(); $this->registerTasker(); } /** * */ private function registerRepository() { $this->app->bind( AccountRepositoryInterface::class, function (Application $app) { /** @var AccountRepositoryInterface $repository */ $repository = app(AccountRepository::class); if ($app->auth->check()) { $repository->setUser(auth()->user()); } return $repository; } ); } /** * */ private function registerTasker() { $this->app->bind( AccountTaskerInterface::class, function (Application $app) { /** @var AccountTaskerInterface $tasker */ $tasker = app(AccountTasker::class); if ($app->auth->check()) { $tasker->setUser(auth()->user()); } return $tasker; } ); } }