1. Go to this page and download the library: Download awes-io/navigator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
awes-io / navigator example snippets
// config/navigation.php
return [
[
'name' => 'Projects',
'route' => 'projects.index', // route must exist or item will be hidden
'children' =>
[
[
'name' => 'New projects',
'link' => '/projects/new', // you can use direct links
]
]
],
[
'name' => 'Packages',
'route' => 'packages.index',
]
];
use AwesIO\Navigator\Facades\Navigator;
$menu = Navigator::buildMenu(config('navigation.menu'), ['depth' => 2], [], function ($item) {
$item->put('meta', $item->get('title') . ' / ' . $item->get('link'));
});
// using helper, rendering depth set via config as a second parameter
$menu = buildMenu(config('navigation.menu'), ['depth' => 2], [], function ($item) {});
// navigation.php
return [
'menu' => [
[
'title' => 'Products', // menu item's title
'route' => 'products.index', // route name for URL generation
'order' => 1, // parameter to determine the order
'depth' => 1, // depth for the recursive generation of descendants
'children' =>
[
[
'id' => 1, // custom id which overwrites auto-generated one
'title' => 'Catalog',
'link' => 'products/catalog', // explicit relative path for link URL
],
[
'title' => 'Support',
'route' => 'products.support'
]
]
],
[
'title' => 'Contact us',
'route' => 'contacts',
'order' => 2,
],
]
];
Route::group(['middleware' => ['can:manage users']], function () {
Route::get('/', 'RoleController@index')->name('admin.roles.index');
});
// will be excluded from the menu for non-admin users
[
'name' => __('navigation.security'),
'icon' => 'twousers',
'route' => 'admin.roles.index',
],