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