/** * @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'); }
/** * @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); }
/** * @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('保存失败!'); } }