From 977976d86d77a8facf3eb7863b0e601b3e6aa959 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Tue, 9 Nov 2021 21:27:07 +0100 Subject: [PATCH] Some cleaning --- src/Composers/SidebarViewComposer.php | 2 +- src/Providers/ModuleServiceProvider.php | 27 +++++++++---------------- src/Providers/RouteServiceProvider.php | 2 +- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/Composers/SidebarViewComposer.php b/src/Composers/SidebarViewComposer.php index cd3ddbd..b5d7c8a 100644 --- a/src/Composers/SidebarViewComposer.php +++ b/src/Composers/SidebarViewComposer.php @@ -2,8 +2,8 @@ namespace TypiCMS\Modules\Events\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 042a259..2d7aa27 100644 --- a/src/Providers/ModuleServiceProvider.php +++ b/src/Providers/ModuleServiceProvider.php @@ -5,6 +5,7 @@ use Eluceo\iCal\Component\Calendar as EluceoCalendar; use Eluceo\iCal\Component\Event as EluceoEvent; 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; @@ -15,13 +16,13 @@ class ModuleServiceProvider extends ServiceProvider { - public function boot() + public function boot(): void { $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'typicms.events'); $this->mergeConfigFrom(__DIR__.'/../config/permissions.php', 'typicms.permissions'); - $modules = $this->app['config']['typicms']['modules']; - $this->app['config']->set('typicms.modules', array_merge(['events' => ['linkable_to_page']], $modules)); + config(['typicms.modules.events' => ['linkable_to_page']]); + config(['typicms.modules.events' => ['linkable_to_page']]); $this->loadViewsFrom(__DIR__.'/../../resources/views/', 'events'); @@ -42,34 +43,26 @@ public function boot() // Observers Event::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('events::public.*', function ($view) { + View::composer('events::public.*', function ($view) { $view->page = TypiCMS::getPageLinkedToModule('events'); }); } - 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('Events', Event::class); + $this->app->bind('Events', Event::class); /* * Calendar service */ - $app->bind('TypiCMS\Modules\Events\Services\Calendar', function () { + $this->app->bind('TypiCMS\Modules\Events\Services\Calendar', function () { return new Calendar( new EluceoCalendar('TypiCMS'), new EluceoEvent() diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php index 11acb26..27e26dc 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