Skip to content

Commit

Permalink
Some cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
sdebacker committed Nov 9, 2021
1 parent f7c6291 commit 977976d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/Composers/SidebarViewComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
27 changes: 10 additions & 17 deletions src/Providers/ModuleServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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');

Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class RouteServiceProvider extends ServiceProvider
{
public function map()
public function map(): void
{
/*
* Front office routes
Expand Down

0 comments on commit 977976d

Please sign in to comment.