app->bind( BillRepositoryInterface::class, function (Application $app) { /** @var BillRepositoryInterface $repository */ $repository = app(BillRepository::class); if ($app->auth->check()) { $repository->setUser(auth()->user()); } return $repository; } ); } }