On this page
修改权限状态
控制器 app/controller/admin/Rule.php
php
public function updateStatus()
{
$rule = $this->request->Model;
$rule->status = $this->request->param('status');
return showSuccess($rule->save());
}
验证器 app/validate/admin/Rule.php
// 验证规则
php
protected $rule = [
...
'id'=>'require|integer|>:0|isExist:Rule',
'status'=>'require|integer|in:0,1'
...
];
protected $scene = [
...
'updateStatus'=>['id','status'],
];
路由 router/admin.php
php
Route::post('rule/:id/update_status','admin.Rule/updateStatus');