Download the PHP package rspeekenbrink/laravel-menu without Composer
On this page you can find all versions of the php package rspeekenbrink/laravel-menu. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rspeekenbrink/laravel-menu
More information about rspeekenbrink/laravel-menu
Files in rspeekenbrink/laravel-menu
Package laravel-menu
Short Description Simple menu generation in Laravel
License MIT
Informations about the package laravel-menu
Laravel Menu
Create menu objects server-sided without sweat for Front-End adoption.
Installation
You can install the package via composer:
Usage
A default menu will already be registered and bound to the Menu
facade. You can add items to the menu like this:
The itemName should be unique within the menu since this is the identifier of the item in the Menu.
Route attribute and Active state
The route can be an absolute route like or a name of a route like for the automatic active state checking to work properly. If you want to use route names we recommend you to use Ziggy to convert the names to URLs in your front-end.
The active attribute is a boolean that will be true if the route matches the route of the current request (path or name wise).
Nested Routes
To create nested items you could use the following:
Attributes
You can pass attributes to the MenuItem to define values like Title or anything else you desire;
Adding items condition wise or via Auth Guards
If you would like to add menu items conditionwise, for example only add a menu item if a user is logged in, you can do it like this:
Or pass a Auth Guard:
Usage with InertiaJS
The main purpose of this package is to create Menu objects that can be adopted easily by the Front-End. One of the easiest ways to transfer the objects from the back to the front is by using InertiaJS.
Then for example in your inertia-vue layout template;
Testing
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-menu with dependencies
illuminate/contracts Version ^6|^7|^8|^9|^10|^11
illuminate/database Version ^6|^7|^8|^9|^10|^11
illuminate/support Version ^6|^7|^8|^9|^10|^11
ext-json Version *