plokko / menu-builder
There is no license information available for the latest version (0.1.2) of this package.
Laravel menu builder
0.1.2
2023-05-25 09:32 UTC
Requires
- php: >=7.2
README
A Laravel heper to create menu.
Installation
Install throught composer composer require plokko/menu-builder
The package will be auto registered in laravel >=5.5; If you use laravel <5.5 follow the next two steps
- Add service provider to
config/app.php
inproviders
section
plokko\MenuBuilder\MenuBuilderServiceProvider::class,
- Register package facade in
config/app.php
inaliases
section (optional)
plokko\MenuBuilder\Facades\Menu::class,
Usage
The MenuHelper package helps you define menu items via a fluent definition.
You can easly add items to the menu, instantiated via the Menu facade, via the "item" function; you can easly define other menu or items proprieties via other functions like so:
$menu = Menu::useTrans('menu.main') ->item('home')->route('home')->icon('home') ->item('clients')->route('clients.index')->icon('business') ->item('curtain-models')->route('curtain-models.index')->icon('blinds') ->whenHasRole('admin', fn($m) => $m->item('users')->route('users.index')->icon('account_circle')->color('pink') ); $menuArray = $menu->toArray();