我想验证客户提交的电子邮件地址,但如果客户提交自己的电子邮件地址,我不希望弹出错误
现在我的电子邮件验证如下所示:
['email', 'unique', 'targetClass' => Client::class, 'message' => 'This email address is taken']
但我希望能够传递一个函数'unique'
来确定是否需要应用'unique'
过滤器,如下所示:
['email', 'unique', 'unique' => function($value) { /* ... */ }, 'targetClass' => Client::class, 'message' => 'This email address is taken']
精慕HU