function ($query) { $query->where('status', 'published') ->where('show_in_menu', true) ->orderBy('sort_order', 'asc') ->orderBy('title', 'asc'); }]) ->whereNull('parent_id') ->where('status', 'published') ->where('show_in_menu', true) ->orderBy('sort_order', 'asc') ->orderBy('title', 'asc') ->get(); }); // If menu template is provided, use it to wrap the menu if ($menuTemplate && !empty($menuTemplate['html_content'])) { $html = $menuTemplate['html_content']; // Replace {menu} placeholder with rendered menu structure $renderedMenu = self::buildMenuStructure($menuItems); $html = str_replace('{menu}', $renderedMenu, $html); return $html; } // Otherwise, return default menu structure return self::buildMenuStructure($menuItems); } /** * Build menu structure HTML from menu items * * @param \Illuminate\Support\Collection $menuItems * @return string HTML structure */ protected static function buildMenuStructure($menuItems): string { if ($menuItems->isEmpty()) { return ''; } $html = '
'; return $html; } /** * Build submenu structure recursively * * @param \Illuminate\Support\Collection $children * @return string Submenu HTML */ protected static function buildSubmenu($children): string { $html = ''; return $html; } /** * Clear menu cache */ public static function clearCache(): void { Cache::forget('menu_items'); } }