Created
March 30, 2018 09:31
-
-
Save the94air/3d97448717964179a3007132c42ebb88 to your computer and use it in GitHub Desktop.
Bootstrap 4 voyager menu template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@php | |
if (Voyager::translatable($items)) { | |
$items = $items->load('translations'); | |
} | |
@endphp | |
<ul class="navbar-nav ml-auto"> | |
@foreach($items as $item) | |
@if($item->children->count()) | |
<li class="nav-item dropdown"> | |
<a class="nav-link dropdown-toggle" href="{{ url($item->url) }}" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | |
{{ $item->title }} | |
</a> | |
<div class="dropdown-menu" aria-labelledby="navbarDropdown"> | |
@foreach($item->children as $subItem) | |
@if($subItem->title == 'divider') | |
<div class="dropdown-divider"></div> | |
@else | |
<a class="dropdown-item {!! url($subItem->link()) == url()->current() ? 'active' : '' !!}" target="{{ $subItem->target }}" href="{{ url($subItem->url) }}">{{ $subItem->title }} {!! url($subItem->link()) == url()->current() ? '<span class="sr-only">(current)</span>' : '' !!}</a> | |
@endif | |
@endforeach | |
</div> | |
</li> | |
@else | |
<li class="nav-item {!! url($item->link()) == url()->current() ? 'active' : '' !!}"> | |
<a class="nav-link" target="{{ $item->target }}" href="{{ url($item->url) }}">{{ $item->title }} {!! url($item->link()) == url()->current() ? '<span class="sr-only">(current)</span>' : '' !!}</a> | |
</li> | |
@endif | |
@endforeach | |
</ul> |
Beautiful! Thank you very much!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NP! @Andy-susanto 😄