One class for user management would be really messy. This commit splits it into more classes.
55 lines
1.7 KiB
PHP
55 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AdminMenusProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Bootstrap the application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
// create instance of main menu
|
|
\Menu::create('mainMenu', function ($menu) {
|
|
/**
|
|
* @var $menu \Pingpong\Menus\MenuBuilder
|
|
*/
|
|
|
|
// create menu entries
|
|
|
|
/*
|
|
* WARNING: MenuBuilder::route() does not seem to work,
|
|
* nor route() helper function. We need to use action() helper instaed.
|
|
*/
|
|
$menu->route('admin.dashboard', trans('admin/mainMenu.dashboard'), [], 1, ['icon' => 'fa fa-dashboard']);
|
|
$menu->dropdown(trans('admin/mainMenu.userManagement'), function($sub) {
|
|
$sub->route('users.new', trans('admin/mainMenu.newUser'), [], 1, ['icon' => 'fa fa-user-plus']);
|
|
$sub->route('users.overview', trans('admin/mainMenu.usersOverview'), [], 2, ['icon' => 'fa fa-users']);
|
|
|
|
}, ['icon' => 'fa fa-users']);
|
|
$menu->url('#', trans('admin/mainMenu.customFields'), 30, ['icon' => 'fa fa-code']);
|
|
$menu->url('#', trans('admin/mainMenu.settings'), 50, ['icon' => 'fa fa-gear']);
|
|
|
|
});
|
|
|
|
// create menu with user profile
|
|
\Menu::create('profileMenu', function ($menu) {
|
|
$menu->url('#', trans('admin/userManagement.profile'));
|
|
$menu->route('logout', trans('admin/common.logout'));
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Register the application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
}
|
|
}
|