protected function setMenu() { Menu::modify('adminlte-sidebar', function ($menu) { $menu->dropdown('Configurações', function ($sub) { $sub->route('admin.mmails.index', 'Formulários', [], 200, ['icon' => 'fa fa-minus', 'active' => function () { return checkActive(route('admin.mmails.index')); }])->hideWhen(function () { return checkRule('admin.mmails.index'); }); $sub->route('admin.maudit.index', 'Logs', [], 210, ['icon' => 'fa fa-minus', 'active' => function () { return checkActive(route('admin.maudit.index')); }])->hideWhen(function () { return checkRule('admin.maudit.index'); }); $sub->route('admin.mcache.index', 'Cache', [], 220, ['icon' => 'fa fa-minus', 'active' => function () { return checkActive(route('admin.mcache.index')); }])->hideWhen(function () { return checkRule('admin.mcache.index'); }); }, 2, ['icon' => 'fa fa-cogs'])->hideWhen(function () { return checkRule(['admin.maudit.index', 'admin.mcache.index', 'admin.mmails.index']); }); }); Menu::modify('adminlte-permissions', function ($menu) { $menu->url('admin.mmails.index', 'Formulários', 200); $menu->url('admin.maudit.index', 'Logs', 210, ['except' => ['create', 'edit', 'destroy', 'trash']]); $menu->url('admin.mcache.index', 'Cache', 220, ['except' => ['create', 'edit', 'destroy', 'trash']]); }); }
protected function setMenu() { Menu::create('adminlte-sidebar', function ($menu) { $menu->setView('vendor.pingpong.menus.adminlte.default'); $menu->dropdown('Usuários', function ($sub) { $sub->route('admin.users.index', 'Usuários', [], 1, ['icon' => 'fa fa-minus', 'active' => function () { return checkActive(route('admin.users.index')); }])->hideWhen(function () { return checkRule('admin.users.index'); }); $sub->route('admin.roles.index', 'Grupos', [], 1, ['icon' => 'fa fa-minus', 'active' => function () { return checkActive(route('admin.roles.index')); }])->hideWhen(function () { return checkRule('admin.roles.index'); }); }, 1, ['icon' => 'fa fa-users'])->hideWhen(function () { return checkRule(['admin.users.index', 'admin.roles.index']); }); }); Menu::create('adminlte-permissions', function ($menu) { $menu->setView('vendor.pingpong.menus.adminlte.permissions'); $menu->url('admin.users', 'Usuários', ['']); $menu->url('admin.roles', 'Grupos', ['']); }); }
protected function setMenu() { Menu::modify('adminlte-sidebar', function ($menu) { $menu->route('admin.maudit.index', 'Logs', [], 210, ['icon' => 'fa fa-tasks', 'active' => function () { return checkActive(route('admin.maudit.index')); }])->hideWhen(function () { return checkRule('admin.maudit.index'); }); }); Menu::modify('adminlte-permissions', function ($menu) { $menu->url('admin.maudit.index', 'Logs', 210, ['except' => ['create', 'edit', 'destroy', 'trash']]); }); }
private function getRules() { $rules = Menu::instance('adminlte-permissions'); return $rules->getItems(); }
<?php use Pingpong\Menus\MenuFacade as Menu; use SmartCarBazar\Models\SiteMenu as ModelMenu; Menu::create('navbar', function ($menu) { $menu->url('/', 'Home'); $menuAll = ModelMenu::roots()->page()->active()->get(); foreach ($menuAll as $parent) { $childrens = $parent->children()->get(); if (0 < count($childrens)) { $menu->dropdown($parent->name, function ($sub) use($childrens) { foreach ($childrens as $child) { $sub->url('page/' . $child->slug, $child->name); } }); } else { $menu->url('page/' . $parent->slug, $parent->name); } } $menu->setPresenter('SmartCarBazar\\Support\\MainMenuPresenter'); });
/** * Register the active menus */ private function registerMenus() { if (!$this->app['asgard.isInstalled']) { return; } $menu = $this->app->make('Modules\\Menu\\Repositories\\MenuRepository'); $menuItem = $this->app->make('Modules\\Menu\\Repositories\\MenuItemRepository'); foreach ($menu->allOnline() as $menu) { $menuTree = $menuItem->getTreeForMenu($menu->id); MenuFacade::create($menu->name, function (Builder $menu) use($menuTree) { foreach ($menuTree as $menuItem) { $this->addItemToMenu($menuItem, $menu); } }); } }