Package Data | |
---|---|
Maintainer Username: | dowilcox |
Maintainer Contact: | dowilcox@umflint.edu (Donald Wilcox) |
Package Create Date: | 2015-03-03 |
Package Last Update: | 2016-11-11 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:16:03 |
Package Statistics | |
---|---|
Total Downloads: | 3,398 |
Monthly Downloads: | 3 |
Daily Downloads: | 0 |
Total Stars: | 4 |
Total Watchers: | 1 |
Total Forks: | 2 |
Total Open Issues: | 0 |
Laravel 5 package to create navigation menus, based on KnpLabs/KnpMenu.
Add to your composer.json file
"dowilcox/knp-menu-laravel": "1.0.*"
In config/app.php add the service provider and alias.
Dowilcox\KnpMenu\MenuServiceProvider::class,
'Menu' => Dowilcox\KnpMenu\Facades\Menu::class,
php artisan vendor:publish
$menu = Menu::create('main-menu', ['childrenAttributes' => ['class' => 'nav']]);
$menu->addChild('Home', ['uri' => url('/')]);
$menu->addChild('Users', ['uri' => route('admin.users.index')]);
$menu->addChild('Roles', ['uri' => route('admin.roles.index')]);
$menu->addChild('Menu', ['uri' => url('menu')]);
echo Menu::render($menu);
Will output:
<ul class="nav">
<li class="first">
<a href="http://localhost:8000">Home</a>
</li>
<li>
<a href="http://localhost:8000/admin/users">Users</a>
</li>
<li>
<a href="http://localhost:8000/admin/roles">Roles</a>
</li>
<li class="current active last">
<a href="http://localhost:8000/menu">Menu</a>
</li>
</ul>