public function compose($view) { \Assets::add(['admin', 'offcanvas', 'datepicker', 'responsive-tables']); // Build menu tree for the top bar $menu = new Node('menu', [self::buildTree()->addChild(AdminPanelMenuComposer::buildTree())]); $rightmenu = new Node('rightmenu', [AdminPanelMenuComposer::buildSecondaryTree()]); // Pass menu to the view $view->with('menu', $menu->setRender(new FoundationTopBar())->purge())->with('rightmenu', $rightmenu->setRender(new FoundationTopBar())->purge()); }
/** * Define the secondary sections of the menu. * * @param User $user User to checked permissions against * * @return array (of Menu\Node) */ public static function makeSecondarySections(User $user) { // Section: Change application language $currentLanguage = app('language'); $allLanguages = Language::getAllByPriority(); $changeLanguage = new Node($currentLanguage); if ($allLanguages->count() > 1) { $newLanguages = new Flat(_('Change language')); foreach ($allLanguages as $l) { if ($l->id != $currentLanguage->id) { // Do not add current language $newLanguages->addChild(new Link(route('language.set', ['code' => $l->code]), $l->name)); } } $changeLanguage->addChild($newLanguages); } // Section: User panel $userPanel = new Node($user->getName()); $userPanel->addChild(new Link(route('user.options'), _('Options'))); $userPanel->addChild(new Link(route('logout'), _('Logout'), ['class' => 'button alert expanded', 'style' => 'height:auto;'])); return compact('changeLanguage', 'userPanel'); }