Using new sidebar event listener for Core module

parent 2185318f
<?php <?php
namespace Modules\Core\Sidebar; namespace Modules\Core\Events\Handlers;
use Maatwebsite\Sidebar\Group; use Maatwebsite\Sidebar\Group;
use Maatwebsite\Sidebar\Menu; use Maatwebsite\Sidebar\Menu;
use Modules\User\Contracts\Authentication; use Modules\Core\Sidebar\AbstractAdminSidebar;
class SidebarExtender implements \Maatwebsite\Sidebar\SidebarExtender class RegisterCoreSidebar extends AbstractAdminSidebar
{ {
/** /**
* @var Authentication * Method used to define your sidebar menu groups and items
*/
protected $auth;
/**
* @param Authentication $auth
*
* @internal param Guard $guard
*/
public function __construct(Authentication $auth)
{
$this->auth = $auth;
}
/**
* @param Menu $menu * @param Menu $menu
*
* @return Menu * @return Menu
*/ */
public function extendWith(Menu $menu) public function extendWith(Menu $menu)
......
...@@ -13,14 +13,17 @@ use Modules\Core\Console\DownloadModuleCommand; ...@@ -13,14 +13,17 @@ use Modules\Core\Console\DownloadModuleCommand;
use Modules\Core\Console\InstallCommand; use Modules\Core\Console\InstallCommand;
use Modules\Core\Console\PublishModuleAssetsCommand; use Modules\Core\Console\PublishModuleAssetsCommand;
use Modules\Core\Console\PublishThemeAssetsCommand; use Modules\Core\Console\PublishThemeAssetsCommand;
use Modules\Core\Events\BuildingSidebar;
use Modules\Core\Events\EditorIsRendering; use Modules\Core\Events\EditorIsRendering;
use Modules\Core\Events\Handlers\RegisterCoreSidebar;
use Modules\Core\Foundation\Theme\ThemeManager; use Modules\Core\Foundation\Theme\ThemeManager;
use Modules\Core\Traits\CanGetSidebarClassForModule;
use Modules\Core\Traits\CanPublishConfiguration; use Modules\Core\Traits\CanPublishConfiguration;
use Nwidart\Modules\Module; use Nwidart\Modules\Module;
class CoreServiceProvider extends ServiceProvider class CoreServiceProvider extends ServiceProvider
{ {
use CanPublishConfiguration; use CanPublishConfiguration, CanGetSidebarClassForModule;
/** /**
* Indicates if loading of the provider is deferred. * Indicates if loading of the provider is deferred.
* *
...@@ -79,6 +82,11 @@ class CoreServiceProvider extends ServiceProvider ...@@ -79,6 +82,11 @@ class CoreServiceProvider extends ServiceProvider
$this->app->bind('core.asgard.editor', function () { $this->app->bind('core.asgard.editor', function () {
return new AsgardEditorDirective(); return new AsgardEditorDirective();
}); });
$this->app['events']->listen(
BuildingSidebar::class,
$this->getSidebarClassForModule('core', RegisterCoreSidebar::class)
);
} }
/** /**
......
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