Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Starter Laravel Package

nasirkhan/laravel-starter

Laravel 13 modular starter with separated frontend/backend. Includes auth & authorization, user/role management, admin backend, backups, log viewer, and custom artisan commands (install, update, module builder). Use as a base to build reusable modules.

View on GitHub
Deep Wiki
Context7

Menu Management Guide

This document explains how menu and menu items are managed in the Laravel Starter application.

Overview

The application uses a hierarchical menu system where:

  • Menus are containers that define where navigation appears (e.g., sidebar, header, footer)
  • Menu Items are the individual links, dropdowns, and navigation elements within each menu

Architecture

Menu Management Flow

Admin Dashboard
  └── Menus (Index)
       ├── View Menu (Show)
       │    ├── Menu Details
       │    └── Menu Items List (nested display)
       │         ├── Add Menu Item
       │         ├── Edit Menu Item
       │         ├── Delete Menu Item
       │         └── View Menu Item
       └── Create/Edit Menu

Key Design Decision

Menu items are managed through their parent menu, not as a standalone resource. This provides:

  • ✅ Better UX - see all menu items in context of their menu
  • ✅ Clearer hierarchy - understand parent-child relationships
  • ✅ Simplified navigation - one less top-level menu item
  • ✅ Contextual operations - all actions relate to the current menu

Routes

Menu Routes

GET     /admin/menus              - List all menus
POST    /admin/menus              - Create new menu
GET     /admin/menus/create       - Show create form
GET     /admin/menus/{id}         - Show menu details with items
GET     /admin/menus/{id}/edit    - Edit menu
PUT     /admin/menus/{id}         - Update menu
DELETE  /admin/menus/{id}         - Delete menu

Menu Item Routes

POST    /admin/menuitems                   - Create new menu item
GET     /admin/menuitems/create?menu_id=X  - Show create form
GET     /admin/menuitems/{id}              - Show menu item details
GET     /admin/menuitems/{id}/edit         - Edit menu item  
PUT     /admin/menuitems/{id}              - Update menu item
DELETE  /admin/menuitems/{id}              - Delete menu item

Note: There is no /admin/menuitems index route. Menu items are viewed through the menu show page.

Usage

Viewing Menus and Menu Items

  1. Navigate to Admin → Menus
  2. Click on a menu to view its details
  3. The menu show page displays:
    • Menu information (name, location, status)
    • Complete list of menu items with hierarchy
    • Actions for each menu item

Creating a Menu Item

  1. Go to the menu show page
  2. Click "Add Item" or "Add Menu Item" button
  3. Fill in the menu item details
  4. Submit the form
  5. You'll be redirected back to the parent menu's show page

Editing a Menu Item

  1. From the menu show page, click the edit icon (✏️) on any menu item
  2. Update the menu item details
  3. Submit the form
  4. You'll be redirected back to the parent menu's show page

Deleting a Menu Item

  1. From the menu show page, click the delete icon (🗑️) on any menu item
  2. Confirm the deletion
  3. Menu items with children cannot be deleted until children are removed

Technical Implementation

Controller Changes

MenuItemsController changes:

  • ✅ Removed index() and index_data() methods
  • ✅ Updated store() to redirect to parent menu show page
  • ✅ Updated update() to redirect to parent menu show page
  • ✅ Kept create(), show(), edit(), destroy() methods

Route Changes

web.php changes:

// Menu Items routes - index excluded
Route::resource("menuitems", "$controller_name")->except(['index']);

Navigation Changes

menu_data.json changes:

  • ✅ Removed standalone "Menu Items" navigation link
  • ✅ Menu items are accessed through their parent menu

View Changes

Breadcrumbs updated:

  • Menu Item Create: Menus → Menu Details → Create Menu Item
  • Menu Item Edit: Menus → Menu Details → Edit Menu Item
  • Previously: Menu Items → Create/Edit (incorrect context)

Menu Item Display

Menu items are displayed hierarchically with:

  • Indentation showing nesting level
  • Icons if specified
  • Child count badges for parent items
  • Type badges (Link, Dropdown, Divider, etc.)
  • Status indicators (Active, Visible, Published)
  • Action buttons (View, Edit, Delete)

Benefits of This Approach

1. Contextual Management

Menu items are always viewed in the context of their parent menu, making it clear which menu they belong to.

2. Improved UX

Users don't need to navigate to a separate page to see menu items. Everything is in one place.

3. Better Hierarchy Visualization

The nested display with indentation makes parent-child relationships immediately clear.

4. Simplified Navigation

Fewer top-level navigation items mean less cognitive load for administrators.

5. Consistent Workflow

The flow is intuitive:

  1. Find the menu
  2. View its items
  3. Add/edit items directly

Migration Notes

If you're upgrading from a version with standalone menu items:

  1. Bookmarks: Update any bookmarked /admin/menuitems URLs to /admin/menus
  2. Documentation: Update internal docs to reflect the new workflow
  3. Training: Inform users that menu items are now managed through menus
  4. Permissions: The view_menus permission covers both menus and menu items

API Access

If you need programmatic access to all menu items:

use Modules\Menu\Models\MenuItem;

// Get all menu items
$allMenuItems = MenuItem::all();

// Get menu items for a specific menu
$menuItems = MenuItem::where('menu_id', $menuId)->get();

// Get hierarchical structure
$menu = Menu::with('items.children')->find($menuId);

Future Enhancements

Potential improvements to consider:

  • Drag-and-drop reordering of menu items
  • Bulk operations on menu items
  • Menu item templates for common patterns
  • Visual menu builder with live preview
  • Import/export menu structures

Support

For questions or issues with menu management:

  • Check the existing menus in the database
  • Review the menu item relationships
  • Verify permissions are correctly set
  • Check the application logs for errors
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport