@php use ColorlibHQ\AdminLte\Menu\MenuItemHelper; // Flatten the sidebar menu into a searchable list of leaf links. $flatten = function (array $items, array $trail = []) use (&$flatten) { $out = []; foreach ($items as $item) { if (MenuItemHelper::isHeader($item)) { continue; } $text = $item['text'] ?? null; if (MenuItemHelper::isSubmenu($item)) { $childTrail = $text ? array_merge($trail, [$text]) : $trail; $out = array_merge($out, $flatten($item['submenu'], $childTrail)); continue; } $href = $item['href'] ?? ($item['url'] ?? '#'); if (! $text || $href === '#' || $href === '') { continue; } $out[] = [ 'text' => $text, 'href' => $href, 'icon' => $item['icon'] ?? 'bi bi-arrow-right-short', 'group' => implode(' › ', $trail), ]; } return $out; }; $paletteItems = $flatten(app('adminlte')->menu('sidebar')); @endphp @once {{-- Styles are emitted inline here (not via @push('css')) because this partial renders in the , after the head's @stack('css') has already output. --}} @push('js') @endpush @endonce