mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-19 19:01:39 +00:00
Code cleanup and refactoring.
This commit is contained in:
@@ -20,6 +20,8 @@ use FireflyIII\Repositories\Journal\JournalRepository;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalTasker;
|
||||
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalUpdate;
|
||||
use FireflyIII\Repositories\Journal\JournalUpdateInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -50,8 +52,12 @@ class JournalServiceProvider extends ServiceProvider
|
||||
$this->registerRepository();
|
||||
$this->registerTasker();
|
||||
$this->registerCollector();
|
||||
$this->registerUpdater();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function registerCollector()
|
||||
{
|
||||
$this->app->bind(
|
||||
@@ -69,6 +75,9 @@ class JournalServiceProvider extends ServiceProvider
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function registerRepository()
|
||||
{
|
||||
$this->app->bind(
|
||||
@@ -86,6 +95,29 @@ class JournalServiceProvider extends ServiceProvider
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function registerUpdater()
|
||||
{
|
||||
$this->app->bind(
|
||||
JournalUpdateInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var JournalUpdateInterface $tasker */
|
||||
$update = app(JournalUpdate::class);
|
||||
|
||||
if ($app->auth->check()) {
|
||||
$update->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return $update;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function registerTasker()
|
||||
{
|
||||
$this->app->bind(
|
||||
|
Reference in New Issue
Block a user