Using ::class notation

parent 1a865b35
...@@ -68,31 +68,25 @@ class MenuServiceProvider extends ServiceProvider ...@@ -68,31 +68,25 @@ class MenuServiceProvider extends ServiceProvider
*/ */
private function registerBindings() private function registerBindings()
{ {
$this->app->bind( $this->app->bind(MenuRepository::class, function () {
'Modules\Menu\Repositories\MenuRepository', $repository = new EloquentMenuRepository(new Menu());
function () {
$repository = new EloquentMenuRepository(new Menu());
if (! config('app.cache')) { if (! config('app.cache')) {
return $repository; return $repository;
}
return new CacheMenuDecorator($repository);
} }
);
$this->app->bind( return new CacheMenuDecorator($repository);
'Modules\Menu\Repositories\MenuItemRepository', });
function () {
$repository = new EloquentMenuItemRepository(new Menuitem());
if (! config('app.cache')) { $this->app->bind(MenuItemRepository::class, function () {
return $repository; $repository = new EloquentMenuItemRepository(new Menuitem());
}
return new CacheMenuItemDecorator($repository); if (! config('app.cache')) {
return $repository;
} }
);
return new CacheMenuItemDecorator($repository);
});
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment