How to merge eloquent validation rule with a Rule::
This is what I am attempting to run, but it chokes on the [ ] with Method Illuminate\Validation\Validator::validateRequired|email does not exist.
public function rules()
{
return [
'email' => [
'required|email:rfc,dns|min:5|max:75',
Rule::unique('email_updates', 'email', 'product_uuid', 'affiliate_uuid')
],
];
}
This line works independently
return [
'email' => 'required|email:rfc,dns|min:5|max:75',
];
This also works
return [
'email' => Rule::unique('email_updates', 'email', 'product_uuid', 'affiliate_uuid'),
];
How do I merge these differing validation syntaxs?
A comment on this question gave me the answer. Method Illuminate\Validation\Validator::validateRequired|min does not exist
You can't use a mix of
|andruleSo this is my working answer
It works, but I seemingly lost the eloquent messages that came with the
|syntax, but that is a small price to pay.