method not exist:app\admin\model\UserModel->validate
作者:互联网
1.
删除model里面没有的validate
添加验证
$validate = new UserValidate();
// var_dump($validate->check($param));exit;
if (!$validate->check($param)) {
return ['code' => 0, 'data' => '', 'msg' => $validate->getError()];
// return $validate->getError();
}
使用原定义的验证规则
protected $rule = [
'toolbar' => 'unique:admin,username',
];
protected $message = [
'toolbar' => '工号已经存在',
];
标签:return,getError,admin,app,param,protected,validate,check 来源: https://www.cnblogs.com/junzibuqing/p/16444080.html