Exemplo n.º 1
0
 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', ['']);
     });
 }
Exemplo n.º 2
0
<?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');
});
Exemplo n.º 3
0
 /**
  * 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);
             }
         });
     }
 }