From 2e5c27401c24387dc162f7fe2ec7e07f70e17c8b Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Tue, 9 Nov 2021 21:28:29 +0100 Subject: [PATCH] Some cleaning --- src/Composers/SidebarViewComposer.php | 2 +- src/Providers/ModuleServiceProvider.php | 22 ++++++---------------- src/Providers/RouteServiceProvider.php | 2 +- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/Composers/SidebarViewComposer.php b/src/Composers/SidebarViewComposer.php index 90e3ee8..e15f734 100644 --- a/src/Composers/SidebarViewComposer.php +++ b/src/Composers/SidebarViewComposer.php @@ -2,8 +2,8 @@ namespace TypiCMS\Modules\Roles\Composers; -use Illuminate\Contracts\View\View; use Illuminate\Support\Facades\Gate; +use Illuminate\View\View; use Maatwebsite\Sidebar\SidebarGroup; use Maatwebsite\Sidebar\SidebarItem; diff --git a/src/Providers/ModuleServiceProvider.php b/src/Providers/ModuleServiceProvider.php index b362049..c9d4efe 100644 --- a/src/Providers/ModuleServiceProvider.php +++ b/src/Providers/ModuleServiceProvider.php @@ -3,20 +3,18 @@ namespace TypiCMS\Modules\Roles\Providers; use Illuminate\Foundation\AliasLoader; +use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; use TypiCMS\Modules\Roles\Facades\Roles; use TypiCMS\Modules\Roles\Models\Role; class ModuleServiceProvider extends ServiceProvider { - public function boot() + public function boot(): void { $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'typicms.roles'); $this->mergeConfigFrom(__DIR__.'/../config/permissions.php', 'typicms.permissions'); - $modules = $this->app['config']['typicms']['modules']; - $this->app['config']->set('typicms.modules', array_merge(['roles' => []], $modules)); - $this->loadViewsFrom(__DIR__.'/../../resources/views/', 'roles'); $this->publishes([ @@ -31,21 +29,13 @@ public function boot() AliasLoader::getInstance()->alias('Roles', Roles::class); - /* - * Sidebar view composer - */ - $this->app->view->composer('core::admin._sidebar', \TypiCMS\Modules\Roles\Composers\SidebarViewComposer::class); + View::composer('core::admin._sidebar', \TypiCMS\Modules\Roles\Composers\SidebarViewComposer::class); } - public function register() + public function register(): void { - $app = $this->app; - - /* - * Register route service provider - */ - $app->register(\TypiCMS\Modules\Roles\Providers\RouteServiceProvider::class); + $this->app->register(\TypiCMS\Modules\Roles\Providers\RouteServiceProvider::class); - $app->bind('Roles', Role::class); + $this->app->bind('Roles', Role::class); } } diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php index a89dfae..9cd9d63 100644 --- a/src/Providers/RouteServiceProvider.php +++ b/src/Providers/RouteServiceProvider.php @@ -10,7 +10,7 @@ class RouteServiceProvider extends ServiceProvider { - public function map() + public function map(): void { /* * Admin routes