The Menu on the dashboard admin is dynamically generated. This menu items are defined from the backend laravel controller located on this file:
1 |
App\Http\Controllers\Admin\SinglePageController::displaySPA() |
If you take a look on the
1 |
displaySPA() |
method, you will see an array of MenuItem object being added. The menu item object will look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
// normal menu item new MenuItem([ 'group_requirements' => [], // string array of group names 'permission_requirements' => ['superuser'], // string array of permission keys 'label'=>'Dashboard', // string label to appear on menu 'nav_type' => MenuItem::$NAV_TYPE_NAV, // type can be a nav or a divider 'icon'=>'dashboard', // material icons or font awesome 'route_type'=>'vue', // only supports vue for the meantime 'route_name'=>'dashboard', // the vue-router name you define on vueJS router 'visible'=>true, // whether to show this menu or not ]), // divider menu item new MenuItem([ 'nav_type' => MenuItem::$NAV_TYPE_DIVIDER ]) |
This menu added are automatically filtered under the hood. That means if the user don’t belong to a group name you specified on “group_requirements” array then the menu will be filtered out and will not be visible by the user. The same goes with “permission_requirements”, if the user don’t have the permission you define on the “permission_requirements” array, the menu item will be filtered out.
Ofcourse, this is just UI. You will need to implement security manually to actually deny the user accessing those backend routes.
After adding a menuItem on the ::addMenu() array, you will now see a new menu item when you refresh the dashboard page, but this menu is not doing anything yet when you click it, you should create the corresponding vueJS routes and vue components or files.