Skip to content
关注公众号,获取新课通知

增加会员等级


控制器 app/controller/admin/UserLevel.php

php
public function save(Request $request)
{
    $res = $this->M->save($request->param());
    return showSuccess($res);
}

验证器 app/validate/admin/UserLevel.php

php
// 验证规则
protected $rule = [
    'name'=>'require|chs',
	'level'=>'integer|>=:0',
	'status'=>'require|in:0,1',
	'discount'=>'integer|>=:0',
	'max_price'=>'integer|>=:0',
	'max_times'=>'integer|>=:0',
];

protected $scene = [
    // ...
    'save'=>['name','level','status','discount','max_price','max_times'],
];

路由 router/admin.php

php
Route::post('user_level','admin.UserLevel/save');