'Title', # will be translated by translator * 'link' => 'user/config', # route link * 'icon' => 'fa-book' # font-awesome icon * ] * @return void */ public static function addMenuItem($category, $position, array $menu) { Event::listen(ConfigureUserMenu::class, function ($event) use ($menu, $position) { $new = []; $offset = 0; foreach ($event->menu['user'] as $item) { // push new menu items at the given position if ($offset == $position) { $new[] = $menu; } $new[] = $item; $offset++; } $event->menu['user'] = $new; }); } /** * Add a route. A router instance will be passed to the given callback. * * @param Closure $callback */ public static function addRoute(Closure $callback) { Event::listen(ConfigureRoutes::class, function($event) use ($callback) { return call_user_func($callback, $event->router); }); } }