@php $GLOBALS['menus'] = DB::table('gnr_menu_items') ->where('softDel', 0) ->where('status', 1) ->where('moduleIdFK', 1) // 1 = Inventory Module ->orderBy('serial') ->get(); //dd($GLOBALS['menus']); $mainMenus = $GLOBALS['menus']->where('parent_menu_id', null); function printChildMenu($menu) { $childMenus = $GLOBALS['menus']->where('parent_menu_id', $menu->id); if (count($childMenus) == 0) { echo '
  • ' . $menu->name . '
  • '; } else { echo '
  • '; echo '' . $menu->name . ''; echo ''; echo '
  • '; } } @endphp