Exemple #1
0
 /**
  * Compiles and returns a menu structure based on a template
  *
  * @param string $groupName
  * @param array $options
  *
  * @return View|null
  */
 public static function render($groupName, array $options = null)
 {
     self::$options = $options;
     if (empty($groupName)) {
         return null;
     }
     $group = Group::whereName($groupName)->first();
     if ($group && $group->count()) {
         $menu = Menu::whereGroupId($group->id)->whereActive(1)->orderBy('order')->get()->toArray();
         self::$tree = self::buildMenuTree($menu);
     }
     if (isset($options['templates']) && isset($options['templates']['container'])) {
         return view($options['templates']['container'], ['menuTree' => self::$tree, 'options' => $options]);
     }
     return view('menuBuilder::menu.default', ['menuTree' => self::$tree, 'options' => $options]);
 }
Exemple #2
0
 /**
  * Removes a group from the system
  *
  * @param int $id
  *
  * @return int
  */
 public function deleteGroup($id)
 {
     return Group::destroy($id);
 }
 /**
  * Edit an existing menu item
  *
  * @param int $id
  *
  * @return View
  */
 public function edit($id)
 {
     return view('menuBuilder::menu.create', ['item' => Menu::find($id), 'groups' => Group::all(), 'items' => Menu::all()]);
 }
 /**
  * Modifies and existing group
  *
  * @param int $id
  *
  * @return View
  */
 public function edit($id)
 {
     return view('menuBuilder::group.create', ['group' => Group::find($id)]);
 }