mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Refactor currency repository.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user