public function edit() { $id = request('id'); if (isset($_POST['id'])) { $data['name'] = request('name'); $data['pid'] = request('pid'); $data['url'] = request('url'); $data['hidden'] = intval(request('hidden')); if (MenuModel::update($id, $data)) { $this->success('/admin/menu'); } else { $this->error(); } } else { $menu = MenuModel::get($id); $this->assign('menu', $menu); $this->display(); } }