Create an abstract sidebar class to avoid repetition

parent c93dbd28
<?php
namespace Modules\Core\Sidebar;
use Maatwebsite\Sidebar\Menu;
use Modules\Core\Events\BuildingSidebar;
use Modules\User\Contracts\Authentication;
use Maatwebsite\Sidebar\SidebarExtender;
abstract class AbstractAdminSidebar implements SidebarExtender
{
/**
* @var Authentication
*/
protected $auth;
/**
* @param Authentication $auth
*
* @internal param Guard $guard
*/
public function __construct(Authentication $auth)
{
$this->auth = $auth;
}
public function handle(BuildingSidebar $sidebar)
{
$sidebar->add($this->extendWith($sidebar->getMenu()));
}
/**
* Method used to define your sidebar menu groups and items
* @param Menu $menu
* @return Menu
*/
abstract public function extendWith(Menu $menu);
}
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