我正在尝试使用Ardent的validate()方法验证用户,但我总是收到带有以下额外信息的HY093错误
(SQL: select count(*) as aggregate from
:{用户{1}}电子邮件where
我使用Sentry2进行“用户”表数据库迁移。
我的用户模型设置如下:
= my.email@gmail.com)
从表单中,我有POST数据,包括['email','first_name','last_name','password','password_confirmation]及其各自的值,这些值转到我的UserController中的以下函数:
/**
* Validation Rules for ARDENT here
*/
public static $rules = [
'first_name' => 'required',
'last_name' => 'required',
'email' => 'required|email|unique::users',
'password' => 'required|between:8,32|confirmed',
'password_confirmation' => 'required|between:8,32',
];
/**
* The attributes that can be added to a new User using $user->fill()
*
* @var array
*/
protected $fillable = [
'first_name',
'last_name',
'email',
'password',
'password_confirmation'
];
/**
* Automatically removes _confirmation attributes
*
* @var boolean
*/
public $autoPurgeRedundantAttributes = true;
我的代码始终在public function signup() {
// Create a new User object
$user = new User();
// Populate attributes with information described in User->fillable
$user->fill( Input::all() );
// Check if info is valid using Ardent's validate() method
if ( $user->validate() ) {
....
....
....
行上失败。任何人都可以帮我解释一下这种情况吗?
答案 0 :(得分:0)
问题在于这一行
'email' => 'required|email|unique::users'
应该是
'email' => 'required|email|unique:users'