Fix missing initialisation

This commit is contained in:
James Cole
2025-03-21 05:36:58 +01:00
parent c620ec1f24
commit d960cc6ad7
2 changed files with 18 additions and 1 deletions

View File

@@ -27,6 +27,8 @@ use FireflyIII\Repositories\Currency\CurrencyRepository;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepository as GroupCurrencyRepository;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface as GroupCurrencyRepositoryInterface;
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepository;
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -72,5 +74,19 @@ class CurrencyServiceProvider extends ServiceProvider
}
);
$this->app->bind(
ExchangeRateRepositoryInterface::class,
static function (Application $app) {
/** @var ExchangeRateRepository $repository */
$repository = app(ExchangeRateRepository::class);
// phpstan does not get the reference to auth
if ($app->auth->check()) { // @phpstan-ignore-line
$repository->setUserGroup(auth()->user()->userGroup);
}
return $repository;
}
);
}
}