@if(isset($menus) && count($menus) > 0)
@php $menus = collect($menus)->chunk(2); @endphp @foreach($menus as $d) @foreach($d as $m) @php $totalChecked = 0; $parentCheck = false; $childChecked = false; $hasChild = false; @endphp @if(isset($m['children']) && count($m['children']) > 0) @foreach($m['children'] as $c) @php $hasChild = true; if(isset($permission) && in_array($c['id'], $permission)) { $childChecked = true; $totalChecked++; } @endphp @endforeach @if($totalChecked == count($m['children'])) @php $parentCheck = true; @endphp @endif @elseif(isset($m['children']) && count($m['children']) < 1) @if(in_array($m['id'],$permission)) @php $parentCheck = true; @endphp @endif @endif @if(isset($fromCompanyMenu) && in_array($m['id'],$permission)) @php $parentCheck = true; @endphp @endif @endforeach @endforeach
@if($hasChild) @endif
@if(isset($m['children']) && count($m['children']) > 0) @foreach($m['children'] as $c) @php $checked = false; if(isset($permission) && in_array($c['id'], $permission)) { $checked = true; } @endphp @endforeach @endif
@endif