/** * Build all Menus. */ public function buildMenus() { $menu = Menu::whereIsRoot()->get(); foreach ($menu as $item) { LavaryMenu::make(Str::slug($item->name), function ($menu) use($item) { $this->buildMenuItems($menu, $item); }); } }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if ($user = Auth::user() and $user->canOne(['view.students.students', 'contact.students.students', 'apply.students.success', 'view.students.reports'])) { $menu = Menu::get('SidebarMenu'); $submenu = $menu->add(trans('students::students.header'), ['route' => 'students.index'])->prepend('<i class="fa fa-users"></i>'); if ($user->can('view.students.students')) { $submenu->add(trans('students::students.header'), ['route' => 'students.students.index'])->prepend('<i class="fa fa-users"></i>'); } if ($user->can('apply.students.success')) { $submenu->add(trans('students::success.header'), ['route' => 'students.success.index'])->prepend('<i class="fa fa-check-circle-o"></i>'); } if ($user->can('contact.students.students')) { $submenu->add(trans('students::messages.header'), ['route' => 'students.messages.index'])->prepend('<i class="fa fa-envelope"></i>'); } if ($user->can('contact.students.students')) { $submenu->add(trans('students::messages.templates'), ['route' => 'students.tempmail.index'])->prepend('<i class="fa fa-tag"></i>'); } if ($user->can('view.students.reports')) { $submenu->add(trans('students::students.report'), ['route' => 'students.report.index'])->prepend('<i class="fa fa-tag"></i>'); } } return $next($request); }