@php $GLOBALS['menus'] = DB::table('gnr_menu_items') ->where('softDel', 0) ->where('status', 1) ->where('moduleIdFK', 8) // 8 = POS Module ->orderBy('serial') ->get(); $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