@php use App\Models\Backend\menu\frontend\MenuCategory; use App\Models\Backend\menu\frontend\RoleMapping; $navbarCategoryId = MenuCategory::where('category_name', 'Navbar Public')->value('category_id'); $buildSitemap = function($parentId = 0, $level = 0) use (&$buildSitemap, $navbarCategoryId) { $items = RoleMapping::with('menu') ->where('role_code', 'public') ->where('category_id', $navbarCategoryId) ->where('parent_id', $parentId) ->where('status', true) ->orderBy('sort') ->get() ->unique('menu_id'); $tree = []; foreach ($items as $item) { if (!$item->menu || !$item->menu->menu_status) continue; $tree[] = [ 'menu' => $item->menu, 'level' => $level, 'children' => $buildSitemap($item->menu_id, $level + 1), ]; } return $tree; }; $sitemap = $buildSitemap(); @endphp

Peta Laman

Senarai halaman dan pautan yang tersedia dalam portal ini.

@if(count($sitemap))
@foreach($sitemap as $item)
@if($item['menu']->menu_icon)@endif {{ $item['menu']->menu_name }} @if(count($item['children'])) @else

Pautan langsung ke {{ $item['menu']->menu_name }}.

@endif
@endforeach
@else

Tiada pautan buat masa ini.

@endif