public function map(MenuBuilder $builder, Router $router) { foreach ($builder->get() as $menu) { if ($menu->hasSubmenus()) { $this->map($menu->getSubmenuBuilder(), $router); continue; } else { if (!$menu instanceof BaseMenu) { throw new UnexpectedValueException("Expect menu to be an instanceof BaseMenu."); } } $router->group(['namespace' => $menu->getNamespace()], function ($router) use($menu) { $menu->registerRoutes($router); }); } }
public function load($crudClass) { $this->crudClass = Vector::getLastSplited($crudClass, "\\"); $this->computedMenus = MenuBuilder::getInstance()->get(); $this->loadPageTitle(); $this->loadPageBreadcrumbs(); $this->loadRoutes(); }
public function get() { $this->list = $this->build(MenuBuilder::getInstance()->get()); return $this->list; }