예제 #1
0
 /**
  * @param $id
  * @return \Illuminate\Contracts\View\View
  */
 public function sort($id)
 {
     $crumb = [];
     Menu::buildCrumb($id, $crumb);
     $parent = Menu::findOrFail($id);
     $items = Menu::whereParentId($id)->orderBy('order_id')->get();
     $this->share('group', MenuGroup::find($parent->group_id));
     $this->share('crumbs', $crumb);
     $this->share('items', $items);
     $this->share('parent', $parent);
     return $this->view('menu.item.sort');
 }
예제 #2
0
 /**
  * @param $name
  * @param string $template
  * @return mixed
  */
 public function make($name, $template = '')
 {
     $group = MenuGroup::whereAlias($name)->firstOrFail();
     $menus = $this->build($group->id);
     return $this->view->make($template)->withMenus($menus);
 }
예제 #3
0
 /**
  * @param \Notadd\Menu\Requests\MenuGroupEditRequest $request
  * @param $id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update(MenuGroupEditRequest $request, $id)
 {
     $group = MenuGroup::findOrFail($id);
     if ($group->update($request->all())) {
         return $this->redirect->to("admin/menu");
     } else {
         return $this->redirect->back()->withInput()->withErrors('保存失败!');
     }
 }