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