根据Laravel Documentation,bail
规则应在首次验证失败后停止运行验证规则。
我在App\Http\*
命名空间之外有一个文件,其中包含以下代码:
if(Validator::make($params,[
'email' => 'bail|required|email|max:60|exists:customers,email','password' => 'required|max:60|string','password' => new CustomerCheckPassword($params['email']),]) -> fails())
throw new Exception('message here');
工作得像咒符一样,当bail
不包含email
时,$params['email']
属性的customers.email
规则不会停止验证,并继续进行{{1 }}。您对此问题有任何想法或优雅的解决方法吗?