`class User extends Validate { protected $rule = [ 'account' => 'alphaNum|require|length:4,11|token|unique:users', 'password' => 'require|min:6', 'password_confirm' => 'require|confirm', 'email' => 'email|unique:user', 'name' => 'chs|require|length:4,8', 'phone' => 'number', ];
protected $message = [
'account.alphaNum' => '账号只能是字母和数字',
'account.require' => '账号不能为空',
'account.length' => '账号长度规定为4~11位',
'account.unique' => '账号已经存在',
'password.require' => '密码不能为空',
'password.confirm' => '两次输入的密码不一致',
'password.min' => '密码至少需要6位',
'email.email' => '电子邮箱格式不正确',
'email.unique' => '电子邮箱已经存在',
'name.length' => '姓名最大字数为4',
'name.chs' => '姓名只能是中文',
'phone.number' => '电话号码只能是数字',
];
protected $scene = [
'login' => ['account','password'],
];
} 使用唯一验证“unique:user”会找不到user表,但是使用unique:users就不会报错了,不知道是不是Bug
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'yqadmin.yq' doesn't exist`