taktik - laravel
This commit is contained in:
44
app/Providers/CategoryServiceProvider.php
Normal file
44
app/Providers/CategoryServiceProvider.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Services\Category\CategoryService;
|
||||
use App\Services\Category\CategoryServiceInterface;
|
||||
use App\Services\QueryRequestModifiers\Category\CategoryFilter;
|
||||
use App\Services\QueryRequestModifiers\Category\CategoryOrder;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class CategoryServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->singleton(CategoryFilter::class, function (Application $app) {
|
||||
return new CategoryFilter();
|
||||
});
|
||||
|
||||
$this->app->singleton(CategoryOrder::class, function (Application $app) {
|
||||
return new CategoryOrder();
|
||||
});
|
||||
|
||||
$this->app->singleton(CategoryServiceInterface::class, function (Application $app) {
|
||||
return new CategoryService(
|
||||
$this->app->get(CategoryFilter::class),
|
||||
$this->app->get(CategoryOrder::class),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user