本文整理汇总了PHP中Menu::make方法的典型用法代码示例。如果您正苦于以下问题:PHP Menu::make方法的具体用法?PHP Menu::make怎么用?PHP Menu::make使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu::make方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_generates_submenus
function test_generates_submenus()
{
// Having
$items = ['home' => ['url' => '/'], 'about' => ['submenu' => ['team' => [], 'careers' => ['title' => 'Work with us']]], 'projects' => ['title' => 'Our projects', 'url' => 'projects'], 'contact' => ['url' => 'contact-us']];
// Expect
$this->assertTemplate('menus/submenu', Menu::make($items)->render());
}
示例2: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$uri_segments = $request->segments();
if (!empty($uri_segments) && in_array("api", $uri_segments)) {
return $next($request);
}
if (\Auth::guest()) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest('http://login.' . \Config::get('app.domain') . '/');
}
}
$usuario = \Auth::user();
if (!empty($usuario)) {
//Menú de administrador
if ($usuario->hasRole('administrador')) {
\Menu::make('menu_lateral', function ($menu) {
$menu->add('Inicio', 'inicio');
});
}
} else {
\Redirect::to('/error500');
}
return $next($request);
}
示例3: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (student()) {
$menu = Menu::make('StudentSidebarMenu', function ($menu) {
});
$menu->add(trans('الأسئلة الشائعة'), ['route' => 'students.faq.index'])->prepend('<i class="fa fa-briefcase"></i>');
}
return $next($request);
}
示例4: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
\Menu::make('BreadCrumb', function ($menu) {
$mainNav = \Menu::get('MainNav');
foreach ($mainNav->items as $key => $item) {
if ($item->attr('class') == 'active') {
$menu->add($item->title, $item->link->path['url']);
}
}
});
return $next($request);
}
示例5: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
\Menu::make('SlidingMetanav', function ($menu) {
//the maximum depth is 4
$menu->add('MyERS', 'https://my.ersnet.org')->prepend('<i class="icon-my-ers icon"></i><span>')->append('</span>');
$menu->add('Publications', url("#publications"))->prepend('<i class="icon-publications icon"></i><span>')->append('</span>');
$menu->add('e-learning', 'http://www.ers-education.org/home.aspx')->prepend('<i class="icon-e-learn icon"></i><span>')->append('</span>')->link->attr(array('target' => '_blank'));
$menu->add('ERS Vision', 'http://www.ersvision.org/')->prepend('<i class="icon-vision icon"></i><span>')->append('</span>')->link->attr(array('target' => '_blank'));
$menu->add('Healthy Lung For Life', 'http://www.europeanlung.org/en/projects-and-research/projects/healthy-lungs-for-life/home/')->prepend('<i class="icon-hlfl icon"></i><span>')->append('</span>')->link->attr(array('target' => '_blank'));
$menu->add('European Lung Foundation', 'http://www.europeanlung.org/en/')->prepend('<i class="icon-elf icon"></i><span>')->append('</span>')->link->attr(array('target' => '_blank'));
$menu->add('TB Consilium', 'https://www.tbconsilium.org/')->prepend('<div class="tb_consilium_nav clearfix"><i class="icon-ers icon pull-left"></i><i class="icon-who icon pull-right who-icon"></i></div><span>')->append('</span>')->link->attr(array('target' => '_blank'));
});
return $next($request);
}
示例6: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
\Menu::make('Metanav', function ($menu) {
$menu->add('The Society', 'the-society')->prepend('<i class="s7-culture icon"></i><span>')->append('</span>');
$menu->theSociety->add('Who we are', 'who-we-are');
$menu->theSociety->add('Assemblies', 'assemblies')->prepend('<span>')->append('</span>');
$menu->assemblies->add('Assembly 1', 'assemblies/assembly-1');
$menu->assembly1->add('Group 1.1', 'assemblies/group-1-1');
$menu->assemblies->add('Assembly 2', 'assembliesassembly-2');
$menu->assemblies->add('Assembly 3', 'assembliesassembly-3');
$menu->assemblies->add('Assembly 4', 'assembliesassembly-4');
$menu->theSociety->add('Something Else', 'something-else')->prepend('<span>')->append('</span>');
$menu->somethingElse->add('Something 1', 'something-else/assembly-1');
$menu->something1->add('Group 1.1', 'something-else/group-1-1');
$menu->somethingElse->add('Something 2', 'something-else/assembly-2');
$menu->somethingElse->add('Something 3', 'something-else/assembly-3');
$menu->somethingElse->add('Something 4', 'something-else/assembly-4');
$menu->add('The Club', 'the-club')->prepend('<i class="s7-culture icon"></i><span>')->append('</span>');
$menu->theClub->add('Who we are', 'who-we-are');
});
return $next($request);
}
示例7: function
|
*/
Route::get('/', function () {
return view('welcome');
});
Route::get('about/contact', ['as' => 'contact', 'uses' => 'PagesController@getContact']);
Route::get('/parts', ['as' => 'parts', 'uses' => 'PagesController@getParts']);
Route::get('part_img/get/{id}.notjpg', ['as' => 'get_part_img', 'uses' => 'PartController@get']);
Route::resource('contact', 'PagesController');
Route::resource('get', 'PartController');
/*
Laravel dynamic menu
*/
Menu::make('MyNavBar', function ($menu) {
$menu->add('Sākums', './');
$menu->add('Detaļas', URL::route('parts'));
$menu->add('Kontakti', URL::route('contact'));
});
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::group(['middleware' => ['web']], function () {
Route::auth();
Route::get('/', ['as' => 'index', 'uses' => 'PartsController@index']);
示例8: function
Menu::make('MainNav', function ($menu) use($adminPermsList) {
$menu->raw(strtoupper(Lang::get('navigation.main.title')), ['class' => 'header']);
$menu->add(Lang::get('navigation.main.items.dashboard.title'), ['route' => 'home'])->prepend(HTML::faicon(Lang::get('navigation.main.items.dashboard.icon.fa'), true));
$menu->add(Lang::get('navigation.main.items.scoreboard.title'), ['route' => 'servers.live'])->prepend(HTML::faicon(Lang::get('navigation.main.items.scoreboard.icon.fa'), true));
if (Auth::check() && Auth::user()->ability(null, 'admin.adkats.bans.view')) {
$menu->add(Lang::get('navigation.admin.adkats.items.banlist.title'), ['route' => 'admin.adkats.bans.index'])->prepend(HTML::ionicon(Lang::get('navigation.admin.adkats.items.banlist.icon.ion'), true));
}
$menu->add(Lang::get('navigation.main.items.playerlist.title'), ['route' => 'player.listing'])->prepend(HTML::faicon(Lang::get('navigation.main.items.playerlist.icon.fa'), true));
// If the role can access the chatlogs we can add the item to the navigation list
if (Auth::check() && Auth::user()->ability(null, 'chatlogs') || Config::get('bfacp.site.chatlogs.guest')) {
$menu->add(Lang::get('navigation.main.items.chatlogs.title'), ['route' => 'chatlog.search'])->prepend(HTML::faicon(Lang::get('navigation.main.items.chatlogs.icon.fa'), true));
}
// Only show these if the user is logged in
if (Auth::check()) {
/*===============================================
= AdKats Admin Navigation =
===============================================*/
if (Auth::user()->ability(null, $adminPermsList['adkats'])) {
$adkats = $menu->raw(Lang::get('navigation.admin.adkats.title'));
if (Auth::user()->ability(null, 'admin.adkats.user.view')) {
$adkats->add(Lang::get('navigation.admin.adkats.items.users.title'), ['route' => 'admin.adkats.users.index'])->prepend(HTML::faicon(Lang::get('navigation.admin.adkats.items.users.icon.fa'), true));
}
if (Auth::user()->ability(null, 'admin.adkats.special.view')) {
$adkats->add(Lang::get('navigation.admin.adkats.items.special_players.title'), ['route' => 'admin.adkats.special_players.index'])->prepend(HTML::faicon(Lang::get('navigation.admin.adkats.items.special_players.icon.fa'), true));
}
}
/*=============================================
= Site Admin Navigation =
=============================================*/
if (Auth::user()->ability(null, $adminPermsList['site'])) {
$site = $menu->raw(Lang::get('navigation.admin.site.title'));
if (Auth::user()->ability(null, 'admin.site.users')) {
$site->add(Lang::get('navigation.admin.site.items.users.title'), ['route' => 'admin.site.users.index'])->prepend(HTML::faicon(Lang::get('navigation.admin.site.items.users.icon.fa'), true));
}
if (Auth::user()->ability(null, 'admin.site.roles')) {
$site->add(Lang::get('navigation.admin.site.items.roles.title'), ['route' => 'admin.site.roles.index'])->prepend(HTML::faicon(Lang::get('navigation.admin.site.items.roles.icon.fa'), true));
}
if (Auth::user()->ability(null, 'admin.site.settings.site')) {
$site->add(Lang::get('navigation.admin.site.items.settings.title'), ['route' => 'admin.site.settings.index'])->prepend(HTML::faicon(Lang::get('navigation.admin.site.items.settings.icon.fa'), true));
$site->add(Lang::get('navigation.admin.site.items.updater.title'), ['route' => 'admin.updater.index'])->prepend(HTML::faicon(Lang::get('navigation.admin.site.items.updater.icon.fa'), true));
}
if (Auth::user()->ability(null, 'admin.site.settings.server')) {
$site->add(Lang::get('navigation.admin.site.items.servers.title'), ['route' => 'admin.site.servers.index'])->prepend(HTML::faicon(Lang::get('navigation.admin.site.items.servers.icon.fa'), true));
}
}
}
});
示例9: menu
function menu($menu)
{
return Menu::make($menu);
}
示例10: function
Route::get('lang/{lang}', ['as' => 'lang.switch', 'uses' => 'LanguageController@switchLang']);
Route::get('/captcha/{config?}', function (\Mews\Captcha\Captcha $captcha, $config = 'default') {
return $captcha->src($config);
});
Route::any('captcha-test', function () {
if (Request::getMethod() == 'POST') {
$rules = ['captcha' => 'required|captcha'];
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
echo '<p style="color: #ff0000;">Incorrect!</p>';
} else {
echo '<p style="color: #00ff30;">Matched :)</p>';
}
}
$form = '<form method="post" action="captcha-test">';
$form .= '<input type="hidden" name="_token" value="' . csrf_token() . '">';
$form .= '<p>' . captcha_img() . '</p>';
$form .= '<p><input type="text" name="captcha"></p>';
$form .= '<p><button type="submit" name="check">Check</button></p>';
$form .= '</form>';
return $form;
});
Menu::make('MyNavBar', function ($menu) {
$menu->add('Home');
$menu->add('About');
});
});
Route::group(['middleware' => 'web'], function () {
Route::auth();
Route::get('/admin', 'HomeController@index');
});
示例11: buildMenu
protected function buildMenu($tree)
{
\Menu::make('navBar', function ($menu) use($tree) {
foreach ($tree as $link) {
// $item = $menu->add($link['description'], array(
// 'action' => 'CidadeController@getEdit'
// ));
$item = $menu->add($link['description'], $link['linkhref']);
if (isset($link['children'])) {
$this->extractChild($link['children'], $item);
}
}
});
}
示例12: function
// Choix des éléments à modérer
// Contrôleur de création d'une campagne (méthodes GET et POST à l'intérieur)
Route::controller('admin/campagne', 'CampagneController');
// Affectation et visualisation des jurés des campagnes
Route::get('/admin/jures', function () {
return view('admin/jures');
});
Route::get('/admin/jures/{id}', function ($id) {
return view('admin/jures')->with('id', $id);
})->where('id', '[1-9]\\d*');
Route::post('/admin/jures/{id}', 'Admin\\AdminController@affectation');
Menu::make('adminMenu', function ($menu) {
$menu->add('Créer une campagne', 'admin/campagne/form');
$menu->add('Suivre les campagnes', 'admin/campagne');
$menu->add('Affecter des jurés', 'admin/jures');
$menu->add('Statistiques', 'admin/stats');
});
});
// RÉSERVER AUX UTILISATEURS JUGES SEULEMENT
Route::get('jugement', ['before' => 'auth', 'uses' => 'Jugement\\JugementController@getAccueil']);
Route::get('jugement/{idc}/filtrer', ['before' => 'auth', 'uses' => 'Jugement\\JugementController@filtrer'])->where('idc', '[1-9]\\d*');
Route::post('jugement/{idc}/filtrer', ['before' => 'auth', 'uses' => 'Jugement\\JugementController@continuer'])->where('idc', '[1-9]\\d*');
Route::get('jugement/{idc}/classer', ['before' => 'auth', 'uses' => 'Jugement\\JugementController@classer'])->where('idc', '[1-9]\\d*');
Route::post('jugement/{idc}/classer', ['before' => 'auth', 'uses' => 'Jugement\\JugementController@finir'])->where('idc', '[1-9]\\d*');
// MENU DU SITE DE COMPÉTITIONS D'IMAGES
Menu::make('MyNavBar', function ($menu) {
$menu->add('Accueil', '');
$menu->add('Campagnes en cours', 'campagnes');
$menu->add('Résultats des campagnes', 'resultats');
$menu->add('Jugement', 'jugement');
});
示例13: function
Menu::make('MainNav', function ($menu) use($adminPermsList, $bfacp) {
$menu->raw(strtoupper(Lang::get('navigation.main.title')), ['class' => 'header']);
$menu->add(Lang::get('navigation.main.items.dashboard.title'), ['route' => 'home'])->prepend(HTML::faicon(Lang::get('navigation.main.items.dashboard.icon.fa'), true));
$menu->add(Lang::get('navigation.main.items.scoreboard.title'), ['route' => 'servers.live'])->prepend(HTML::faicon(Lang::get('navigation.main.items.scoreboard.icon.fa'), true));
if ($bfacp->isLoggedIn && $bfacp->user->ability(null, 'admin.adkats.bans.view')) {
$menu->add(Lang::get('navigation.admin.adkats.items.banlist.title'), ['route' => 'admin.adkats.bans.index'])->prepend(HTML::ionicon(Lang::get('navigation.admin.adkats.items.banlist.icon.ion'), true));
}
$menu->add(Lang::get('navigation.main.items.playerlist.title'), ['route' => 'player.listing'])->prepend(HTML::faicon(Lang::get('navigation.main.items.playerlist.icon.fa'), true));
// If the role can access the chatlogs we can add the item to the navigation list
if ($bfacp->isLoggedIn && $bfacp->user->ability(null, 'chatlogs') || Config::get('bfacp.site.chatlogs.guest')) {
$menu->add(Lang::get('navigation.main.items.chatlogs.title'), ['route' => 'chatlog.search'])->prepend(HTML::faicon(Lang::get('navigation.main.items.chatlogs.icon.fa'), true));
}
// Only show these if the user is logged in
if ($bfacp->isLoggedIn) {
/*===============================================
= Adkats Admin Navigation =
===============================================*/
if ($bfacp->user->ability(null, $adminPermsList['adkats'])) {
$adkats = $menu->raw(Lang::get('navigation.admin.adkats.title'));
if ($bfacp->user->ability(null, 'admin.adkats.user.view')) {
$adkats->add(Lang::get('navigation.admin.adkats.items.users.title'), ['route' => 'admin.adkats.users.index'])->prepend(HTML::faicon(Lang::get('navigation.admin.adkats.items.users.icon.fa'), true));
}
if ($bfacp->user->ability(null, 'admin.adkats.roles.view')) {
$adkats->add(Lang::get('navigation.admin.adkats.items.roles.title'), ['route' => 'admin.adkats.roles.index'])->prepend(HTML::faicon(Lang::get('navigation.admin.adkats.items.roles.icon.fa'), true));
}
if ($bfacp->user->ability(null, 'admin.adkats.special.view')) {
$adkats->add(Lang::get('navigation.admin.adkats.items.special_players.title'), ['route' => 'admin.adkats.special_players.index'])->prepend(HTML::faicon(Lang::get('navigation.admin.adkats.items.special_players.icon.fa'), true));
}
}
/*=============================================
= Site Admin Navigation =
=============================================*/
if ($bfacp->user->ability(null, $adminPermsList['site'])) {
$site = $menu->raw(Lang::get('navigation.admin.site.title'));
if ($bfacp->user->ability(null, 'admin.site.users')) {
$site->add(Lang::get('navigation.admin.site.items.users.title'), ['route' => 'admin.site.users.index'])->prepend(HTML::faicon(Lang::get('navigation.admin.site.items.users.icon.fa'), true));
}
if ($bfacp->user->ability(null, 'admin.site.roles')) {
$site->add(Lang::get('navigation.admin.site.items.roles.title'), ['route' => 'admin.site.roles.index'])->prepend(HTML::faicon(Lang::get('navigation.admin.site.items.roles.icon.fa'), true));
}
if ($bfacp->user->ability(null, 'admin.site.settings.site')) {
$site->add(Lang::get('navigation.admin.site.items.settings.title'), ['route' => 'admin.site.settings.index'])->prepend(HTML::faicon(Lang::get('navigation.admin.site.items.settings.icon.fa'), true));
$site->add(Lang::get('navigation.admin.site.items.updater.title'), ['route' => 'admin.updater.index'])->prepend(HTML::faicon(Lang::get('navigation.admin.site.items.updater.icon.fa'), true));
}
if ($bfacp->user->ability(null, 'admin.site.settings.server')) {
$site->add(Lang::get('navigation.admin.site.items.servers.title'), ['route' => 'admin.site.servers.index'])->prepend(HTML::faicon(Lang::get('navigation.admin.site.items.servers.icon.fa'), true));
}
if ($bfacp->user->ability(null, 'admin.site.system.logs')) {
$site->add(Lang::get('navigation.admin.site.items.system.logs.title'), Config::get('logviewer::base_url'))->prepend(HTML::faicon(Lang::get('navigation.admin.site.items.system.logs.icon.fa'), true));
}
}
$clientIp = $_SERVER['REMOTE_ADDR'];
$whitelist = getenv('IP_WHITELIST') !== false ? explode('|', getenv('IP_WHITELIST')) : [];
if (in_array($clientIp, $whitelist)) {
$menu->add(Lang::get('navigation.main.items.maintenance.title'), ['route' => 'admin.site.maintenance.index'])->prepend(HTML::faicon(Lang::get('navigation.main.items.maintenance.icon.fa'), true));
}
}
});
示例14: function
<?php
Menu::make('MyNavBar', function ($menu) {
$menu->add('Home');
$menu->add('About', 'about')->add('level1', 'level1');
// vlojeno menu
$menu->level1->divide();
$menu->about->add('customer', 'customer');
//vlojeno menu
$menu->add('services', 'services');
$menu->add('Contact', 'contact');
});
$menu = Menu::get('MyNavBar');
echo $menu->asUl();
// echo '<pre>'.print_r($menu->item('about')->children(), true).'</pre>';die();
?>
<!DOCTYPE html>
<html>
<head>
<title>GPS Coordiantes</title>
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/js/jquery-2.1.4.min.js"></script>
<style>
html, body {
height: 100%;
}
body {
margin: 0;
示例15: function
</ul>
</div>
<div class="col-md-12 menuHolhos">
<ul class="nav nav-tabs">
<?php
Menu::make('menu', function ($menu) {
$menu->add('Home', '');
// Menu com subMenu
$menu->add('Sobre Nós', 'teste');
$menu->sobreNos->add('Who We are', 'who-we-are');
$menu->add('Corpo Clínico', 'corpoclinico');
$menu->add('Notícias', 'noticias');
$menu->add('Tecnologia', 'tecnologias');
$menu->add('Depoimentos', 'depoimentos');
$menu->add('Contato', 'contato');
});
$menu = Menu::get('menu')->roots();
?>
@include(config('laravel-menu.views.bootstrap-items'), array('items' => $menu))
</ul>
</div>
</div>