The Menu model represents a navigation menu container in LaraCMS. Each menu can contain multiple menu items organized in a hierarchical structure. This allows you to create different menus for various parts of your site (e.g., header navigation, footer links, sidebar).Namespace:App\Models\MenuFile:app/Models/Menu.php:7
Has many relationship with the MenuItem model. Items are automatically ordered by their order field.Returns:HasMany<MenuItem>Default ordering: By order column (ascending)
// Get all menu items in order$menu = Menu::find(1);$items = $menu->items; // Already ordered// Get only top-level items (no parent)$topLevelItems = $menu->items()->whereNull('parent_id')->get();// Eager load items with children$menu = Menu::with('items.children')->find(1);
// Get menu by name$menu = Menu::where('name', 'primary')->first();// Get all menus with item counts$menus = Menu::withCount('items')->get();// Check if menu existsif (Menu::where('name', 'footer')->exists()) { // Menu exists}