On this page
修改权限
控制器 app/controller/admin/Rule.php
php
public function update(Request $request, $id)
{
$param = $request->param();
$res = $request->Model->save($param);
return showSuccess($res);
}
验证器 app/validate/admin/Rule.php
php
// 验证规则
protected $rule = [
'page' => 'require|integer|>:0',
'id'=>'require|integer|>:0|isExist:Rule',
'rule_id'=>'require|integer|isExist:Rule,false',
'status'=>'require|in:0,1',
'name'=>'require',
'condition'=>'require',
'menu'=>'require|in:0,1',
'order'=>'require|integer',
'method'=>'in:GET,POST,PUT,DELETE',
];
protected $scene = [
...
'update'=>['id','rule_id','status','name','menu','order','method'],
];
路由 router/admin.php
php
Route::post('rule/:id','admin.Rule/update');