Menu Items
You can inject menu items to the menu by simply implementing the MenuItems
provider and adding a method provideMenuItems
to your plugin like this:
You can also add a divider before or after your item like this:
Available methods
Method | Description | Example | Arguments |
__construct | Creates a new Menu item |
| string title: The title string icon: The name of an icon |
route | A route to be used |
| string route: The route key array params: The parameters passed to the route |
url | A URL to be used |
| string url: The URL |
permission | Display/Hide the item based on a permission |
| string permission: The key of a permission, array args: Additional arguments |
divider | Acts as a divider between items |
| - |
exact | Apply the active class only when the current URL matches exactly |
| - |
badge | Display a badge next to the title |
| string color: Tailwind color of the badge (red, green, blue, ...), string value: The value or null |
addChildren | Add children to the item |
| MenuItem item: One or many children |
User dropdown
When you want to display menu items in the user dropdown simply use Voyager\Admin\Classes\UserMenuItem
instead of Voyager\Admin\Classes\MenuItem
.
Last updated