mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 04:03:26 +00:00
Refactor and split category repository.
This commit is contained in:
@@ -24,6 +24,10 @@ namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Repositories\Category\CategoryRepository;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
use FireflyIII\Repositories\Category\NoCategoryRepository;
|
||||
use FireflyIII\Repositories\Category\NoCategoryRepositoryInterface;
|
||||
use FireflyIII\Repositories\Category\OperationsRepository;
|
||||
use FireflyIII\Repositories\Category\OperationsRepositoryInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -47,7 +51,7 @@ class CategoryServiceProvider extends ServiceProvider
|
||||
{
|
||||
$this->app->bind(
|
||||
CategoryRepositoryInterface::class,
|
||||
function (Application $app) {
|
||||
static function (Application $app) {
|
||||
/** @var CategoryRepository $repository */
|
||||
$repository = app(CategoryRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
@@ -57,5 +61,31 @@ class CategoryServiceProvider extends ServiceProvider
|
||||
return $repository;
|
||||
}
|
||||
);
|
||||
|
||||
$this->app->bind(
|
||||
OperationsRepositoryInterface::class,
|
||||
static function (Application $app) {
|
||||
/** @var OperationsRepository $repository */
|
||||
$repository = app(OperationsRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return $repository;
|
||||
}
|
||||
);
|
||||
|
||||
$this->app->bind(
|
||||
NoCategoryRepositoryInterface::class,
|
||||
static function (Application $app) {
|
||||
/** @var NoCategoryRepository $repository */
|
||||
$repository = app(NoCategoryRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return $repository;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user