@php
if (Voyager::translatable($items)) {
$items = $items->load('translations');
}
@endphp
@foreach ($items as $item)
@php
$listItemClass = [];
$styles = null;
$linkAttributes = null;
$transItem = $item;
if (Voyager::translatable($item)) {
$transItem = $item->translate($options->locale);
}
$href = $item->link();
// Current page
if(url($href) == url()->current()) {
array_push($listItemClass, 'active');
}
$permission = '';
$hasChildren = false;
// With Children Attributes
if(!$item->children->isEmpty())
{
foreach($item->children as $child)
{
$hasChildren = $hasChildren || Auth::user()->can('browse', $child);
if(url($child->link()) == url()->current())
{
array_push($listItemClass, 'active');
}
}
if (!$hasChildren) {
continue;
}
$linkAttributes = 'href="#' . $transItem->id .'-dropdown-element" data-toggle="collapse" aria-expanded="'. (in_array('active', $listItemClass) ? 'true' : 'false').'"';
array_push($listItemClass, 'dropdown');
}
else
{
$linkAttributes = 'href="' . url($href) .'"';
if(!Auth::user()->can('browse', $item)) {
continue;
}
}
@endphp
-
{{ $transItem->title }}
@if($hasChildren)
@else
@endif
@endforeach
-