On this page
增加角色
控制器 app/controller/admin/Role.php
php
public function save(Request $request)
{
$res = $this->M->save($request->only([
'status',
'desc',
'name',
]));
return showSuccess($res);
}
验证器 app/validate/admin/Role.php
php
// 验证规则
protected $rule = [
'status'=>'require|in:0,1',
'name'=>'require',
];
protected $scene = [
...
'save'=>['status','name'],
];
路由 router/admin.php
php
Route::post('role','admin.Role/save');