From a916029e888f6536c3daf3fcd075c99f7991c630 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Tue, 9 Nov 2021 21:28:19 +0100 Subject: [PATCH] Some cleaning --- src/Composers/SidebarViewComposer.php | 2 +- src/Providers/ModuleServiceProvider.php | 24 ++++++++---------------- src/Providers/RouteServiceProvider.php | 2 +- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/Composers/SidebarViewComposer.php b/src/Composers/SidebarViewComposer.php index 4f883bb..97c17cc 100644 --- a/src/Composers/SidebarViewComposer.php +++ b/src/Composers/SidebarViewComposer.php @@ -2,8 +2,8 @@ namespace TypiCMS\Modules\Places\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 43d4b8d..151b8c4 100644 --- a/src/Providers/ModuleServiceProvider.php +++ b/src/Providers/ModuleServiceProvider.php @@ -3,6 +3,7 @@ namespace TypiCMS\Modules\Places\Providers; use Illuminate\Foundation\AliasLoader; +use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; use TypiCMS\Modules\Core\Facades\TypiCMS; use TypiCMS\Modules\Core\Observers\SlugObserver; @@ -12,13 +13,12 @@ class ModuleServiceProvider extends ServiceProvider { - public function boot() + public function boot(): void { $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'typicms.places'); $this->mergeConfigFrom(__DIR__.'/../config/permissions.php', 'typicms.permissions'); - $modules = $this->app['config']['typicms']['modules']; - $this->app['config']->set('typicms.modules', array_merge(['places' => ['linkable_to_page']], $modules)); + config(['typicms.modules.places' => ['linkable_to_page']]); $this->loadViewsFrom(__DIR__.'/../../resources/views/', 'places'); @@ -43,28 +43,20 @@ public function boot() // Observers Place::observe(new SlugObserver()); - /* - * Sidebar view composer - */ - $this->app->view->composer('core::admin._sidebar', SidebarViewComposer::class); + View::composer('core::admin._sidebar', SidebarViewComposer::class); /* * Add the page in the view. */ - $this->app->view->composer('places::public.*', function ($view) { + View::composer('places::public.*', function ($view) { $view->page = TypiCMS::getPageLinkedToModule('places'); }); } - public function register() + public function register(): void { - $app = $this->app; - - /* - * Register route service provider - */ - $app->register(RouteServiceProvider::class); + $this->app->register(RouteServiceProvider::class); - $app->bind('Places', Place::class); + $this->app->bind('Places', Place::class); } } diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php index 044f933..1cb7290 100644 --- a/src/Providers/RouteServiceProvider.php +++ b/src/Providers/RouteServiceProvider.php @@ -12,7 +12,7 @@ class RouteServiceProvider extends ServiceProvider { - public function map() + public function map(): void { /* * Front office routes