Using new sidebar event listener for tag module

parent ff240541
<?php
namespace Modules\Tag\Sidebar;
namespace Modules\Tag\Events\Handlers;
use Maatwebsite\Sidebar\Group;
use Maatwebsite\Sidebar\Item;
use Maatwebsite\Sidebar\Menu;
use Modules\User\Contracts\Authentication;
use Modules\Core\Sidebar\AbstractAdminSidebar;
class SidebarExtender implements \Maatwebsite\Sidebar\SidebarExtender
class RegisterTagSidebar extends AbstractAdminSidebar
{
/**
* @var Authentication
*/
protected $auth;
/**
* @param Authentication $auth
*
* @internal param Guard $guard
*/
public function __construct(Authentication $auth)
{
$this->auth = $auth;
}
/**
* Method used to define your sidebar menu groups and items
* @param Menu $menu
*
* @return Menu
*/
public function extendWith(Menu $menu)
......
......@@ -3,9 +3,12 @@
namespace Modules\Tag\Providers;
use Illuminate\Support\ServiceProvider;
use Modules\Core\Events\BuildingSidebar;
use Modules\Core\Traits\CanGetSidebarClassForModule;
use Modules\Core\Traits\CanPublishConfiguration;
use Modules\Tag\Blade\TagWidget;
use Modules\Tag\Entities\Tag;
use Modules\Tag\Events\Handlers\RegisterTagSidebar;
use Modules\Tag\Repositories\Cache\CacheTagDecorator;
use Modules\Tag\Repositories\Eloquent\EloquentTagRepository;
use Modules\Tag\Repositories\TagManager;
......@@ -14,7 +17,7 @@ use Modules\Tag\Repositories\TagRepository;
class TagServiceProvider extends ServiceProvider
{
use CanPublishConfiguration;
use CanPublishConfiguration, CanGetSidebarClassForModule;
/**
* Indicates if loading of the provider is deferred.
*
......@@ -34,6 +37,10 @@ class TagServiceProvider extends ServiceProvider
$this->app->singleton('tag.widget.directive', function ($app) {
return new TagWidget($app[TagRepository::class]);
});
$this->app['events']->listen(
BuildingSidebar::class,
$this->getSidebarClassForModule('tag', RegisterTagSidebar::class)
);
}
public function boot()
......
......@@ -8,6 +8,7 @@ versions:
changed:
- Using the @push js stacks over the scripts section
- Using the @push css stacks over the styles section
- Sidebar is now loaded via the <code>BuildingSidebar</code> hook
"2.1.0":
changed:
- Fixed tags not being removed probably on update & delete
......
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