mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 04:03:26 +00:00
Restucturing some code.
This commit is contained in:
@@ -41,6 +41,12 @@ class JournalServiceProvider extends ServiceProvider
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->registerRepository();
|
||||
$this->registerTasker();
|
||||
}
|
||||
|
||||
private function registerRepository()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Repositories\Journal\JournalRepositoryInterface',
|
||||
@@ -56,4 +62,21 @@ class JournalServiceProvider extends ServiceProvider
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private function registerTasker()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Repositories\Journal\JournalTaskerInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Repositories\Journal\JournalTasker', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
}
|
||||
|
||||
return app('FireflyIII\Repositories\Journal\JournalTasker', $arguments);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user