Refactor currency repository.

This commit is contained in:
James Cole
2023-10-28 06:58:33 +02:00
parent 9e94b9e57e
commit 1d138eed8d
42 changed files with 676 additions and 818 deletions

View File

@@ -25,6 +25,8 @@ namespace FireflyIII\Providers;
use FireflyIII\Repositories\Currency\CurrencyRepository;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepository as GroupCurrencyRepository;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface as GroupCurrencyRepositoryInterface;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -55,6 +57,19 @@ class CurrencyServiceProvider extends ServiceProvider
$repository->setUser(auth()->user());
}
return $repository;
}
);
$this->app->bind(
GroupCurrencyRepositoryInterface::class,
function (Application $app) {
/** @var GroupCurrencyRepository $repository */
$repository = app(GroupCurrencyRepository::class);
// phpstan does not get the reference to auth
if ($app->auth->check()) { // @phpstan-ignore-line
$repository->setUser(auth()->user());
}
return $repository;
}
);