Exemplo n.º 1
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     Menu::make('menus.my.dropdown', function ($menu) {
         $user = auth()->user();
         $menu->add(trans('menus.my.profile'), route('users', $user->id));
     });
     return $next($request);
 }
Exemplo n.º 2
0
Arquivo: My.php Projeto: mrcoco/base
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     Menu::make('menus.my', function ($menu) {
         $menu->add(trans('menus.my.profile'), route('my.profile.index'))->active('my/profile/*');
         $menu->add(trans('menus.my.account'), route('my.account.index'))->active('my/account/*');
         $menu->add(trans('menus.my.email'), route('my.email.index'))->active('my/email/*');
         $menu->add(trans('menus.my.log'), route('my.log.index'))->active('my/log/*');
     });
     return $next($request);
 }
Exemplo n.º 3
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     Menu::make('admin', function ($menu) {
         //$menu->add(trans('menus.admin.home'), route('admin.home.index'))->data(['icon' => 'home']);
         $menu->add(trans('menu.admin.reports'), route('admin.reports.index'))->data(['icon' => 'bar chart'])->active('admin/reports/*');
         $menu->add(trans('menu.admin.users'), route('admin.users.index'))->data(['icon' => 'user'])->active('admin/users/*');
         $menu->add(trans('menu.admin.settings'), route('admin.settings.index'))->data(['icon' => 'setting'])->active('admin/settings/*');
     });
     return $next($request);
 }
 /**
  * init menus
  *
  * @param string $type
  */
 public function menuInit($type)
 {
     Menu::make($type, function ($menu) use($type) {
         $menus = $type . 'Menus';
         foreach ($this->{$menus} as $action) {
             $action::addMenu($menu);
         }
     })->filter(function ($item) {
         if (is_null($item->data('permissions'))) {
             return true;
         }
         return $this->user->is_super_admin || hasPermission($item->data('permissions')) ?: false;
     });
 }
Exemplo n.º 5
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     session()->forget('active_menu');
     if (!$request->is('administrator*')) {
         $this->repository = app(Repository::class);
         $this->repository->getPublished()->each(function (Navigation $navigation) {
             MenuFactory::make($navigation->type, function (Builder $builder) use($navigation) {
                 $navigation->menus->each(function (Menu $menu) use($builder, &$assignment) {
                     $this->generateMenu($builder, $menu);
                 });
             });
         });
     }
     return $next($request);
 }
Exemplo n.º 6
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (auth()->check() && $request->is('administrator*')) {
         Menu::make('admin', function (Builder $menu) {
             $menu->add('Dashboard', route('administrator.index'))->icon('home');
             $navs = app('navigation')->getPublished();
             if ($navs->count()) {
                 $nav = $menu->add('Navigation', '#')->icon('sitemap')->data('permission', 'navigation.view');
                 $nav->add('Manage', route('administrator.navigation.index'))->icon('cogs')->data(['permission' => 'navigation.view', 'append' => route('administrator.navigation.create')]);
                 $navs->each(function ($item) use($nav) {
                     $nav->add($item->title, route('administrator.navigation.menu.index', $item->id))->icon('link')->data(['permission' => 'navigation.view', 'append' => route('administrator.navigation.menu.create', $item->id)]);
                 });
             } else {
                 $menu->add('Navigation', route('administrator.navigation.index'))->icon('link')->data(['permission' => 'navigation.view']);
             }
             $contents = $menu->add('Contents', '#')->icon('files-o');
             $contents->add('Articles', route('administrator.articles.index'))->icon('files-o')->data(['permission' => 'article.view', 'append' => route('administrator.articles.create')]);
             $contents->add('Categories', route('administrator.categories.index'))->icon('file-text')->data(['permission' => 'category.view', 'append' => route('administrator.categories.create')]);
             $contents->add('Widgets', route('administrator.widgets.index'))->icon('plug')->data(['permission' => 'widget.view', 'append' => route('administrator.widgets.create')]);
             $contents->add('Media', route('administrator.media.index'))->icon('image')->data('permission', 'media.view');
             $modules = $menu->add('Modules', '#')->icon('plug')->data('permission', 'modules.view');
             event('admin.menu.build', $modules);
             $menu->add('Themes', route('administrator.themes.index'))->icon('windows')->data(['permission' => 'theme.view']);
             $users = $menu->add('Users', '#')->icon('key')->data(['permission' => ['user.view', 'role.view', 'permission.view']]);
             $users->add('Manage', route('administrator.users.index'))->icon('users')->data(['permission' => 'user.view', 'append' => route('administrator.users.create')]);
             $users->add('Roles', route('administrator.roles.index'))->icon('shield')->data(['permission' => 'role.view', 'append' => route('administrator.roles.create')]);
             $users->add('Permissions', route('administrator.permissions.index'))->icon('tag')->data(['permission' => 'permission.view', 'append' => route('administrator.permissions.create')]);
             $config = $menu->add('Configurations', '#')->icon('gears')->data(['permission' => ['extension.view', 'utilities.config']]);
             $config->add('Extensions', route('administrator.extension.index'))->icon('plug')->data('permission', 'extension.view');
             $config->add('Global', route('administrator.configuration.index'))->icon('globe')->data('permission', 'utilities.config');
             $menu->add('Utilities', route('administrator.utilities.index'))->icon('wrench')->data('permission', 'utilities.view');
             $menu->add('Logout', route('administrator.logout'))->icon('power-off');
         })->filter(function ($item) {
             $permissions = (array) $item->data('permission');
             if (!$permissions) {
                 return true;
             }
             return currentUser()->canAtLeast($permissions);
         });
     }
     $response = $next($request);
     return $response;
 }