@isset ($menu)
@foreach ($menu as $menuItem)
@if (isset($menuItem['header']) & (!isset($menuItem['can']) || auth()->user()->can($menuItem['can'])))
{{$menuItem['header']}}
@elseif(!isset($menuItem['can']) || auth()->user()->can($menuItem['can']))
@if (!isset($menuItem['submenu']))
{{$menuItem['text']}}
@else
@foreach ($menuItem['submenu'] as $submenu)
@if ($submenu['can'] && auth()->user()->can($submenu['can']))
@endif
@endforeach
@endif
@endif
@endforeach
@endif