mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 04:03:26 +00:00
Register and use interface.
This commit is contained in:
@@ -44,6 +44,23 @@ class JournalServiceProvider extends ServiceProvider
|
||||
{
|
||||
$this->registerRepository();
|
||||
$this->registerTasker();
|
||||
$this->registerCollector();
|
||||
}
|
||||
|
||||
private function registerCollector() {
|
||||
$this->app->bind(
|
||||
'FireflyIII\Helpers\Collector\JournalCollectorInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Helpers\Collector\JournalCollector', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
}
|
||||
|
||||
return app('FireflyIII\Helpers\Collector\JournalCollector', $arguments);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private function registerRepository()
|
||||
|
Reference in New Issue
Block a user