How to Add Custom menu in Voyager Laravel? I'm newbie for laravel. I can create list of menu but I can't route to it. I read document in How to Create Custom Menu. I confuse this code.
Menu::display('main', 'bootstrap');
And
<ul>
@foreach ($items as $menu_item)
<li><a href="{{ $menu_item->url }}">{{ $menu_item->title }}</a></li>
@endforeach
</ul>
And
Menu::display('main', 'my_menu');
I don't know this code need to put it somewhere.
Doc Ref
Hi the following code is for custom coding on front end
Custom Query in Controller :
use DB;
public function index(){
$menu = DB::select('select * from menu_items where menu_id=2');
return view('index',['menu' => $menu]);
}
index.blade.php
@foreach($items as $menu_item)
<li><a href="{{ $menu_item->url }}">{{ $menu_item->title }}</a></li>
@endforeach
The first code is if you just want to use the menu using their default styling with bootstrap.
Menu::display('main', 'bootstrap');
The following code block allows you to add custom styling to your menu out of the box. If you wish to use this code block you would place this
<ul>
@foreach($items as $menu_item)
<li><a href="{{ $menu_item->url }}">{{ $menu_item->title }}</a></li>
@endforeach
</ul>
in a blade file resources/views/my_menu.blade.php. then you would display it in your view file where you want it to display. using Menu::display('main', 'my_menu');
what if we want to display also sub-menu
Please sign in or create an account to participate in this conversation.