@php $selected = array(); $table = 'App\Models\Permissions'; foreach($permission_exist as $pe) { $selected[]= $pe->permission_id; } @endphp @foreach($menu as $k=> $m) @php $query= $table::where('menu_id',$m->menu_id)->get(); $count_menu = count($query); @endphp @if($m->menu_url != '#')