Restucturing some code.

This commit is contained in:
James Cole
2016-10-15 12:39:34 +02:00
parent 2f9a4bb79a
commit 8e48e53f17
9 changed files with 708 additions and 280 deletions

View File

@@ -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);
}
);
}
}