. */ declare(strict_types=1); namespace FireflyIII\Providers; use FireflyIII\Repositories\LinkType\LinkTypeRepository; use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** * Class AdminServiceProvider */ class AdminServiceProvider extends ServiceProvider { /** * Bootstrap the application services. */ public function boot() { } /** * Register the application services. */ public function register() { $this->linkType(); } /** * Register link type repository */ private function linkType() { $this->app->bind( LinkTypeRepositoryInterface::class, function (Application $app) { /** @var LinkTypeRepository $repository */ $repository = app(LinkTypeRepository::class); if ($app->auth->check()) { $repository->setUser(auth()->user()); } return $repository; } ); } }