How can I validate an array value in Laravel 5.1? Each values of the array should be validated. Number of array values may increase or decrease. But the name will be same. My sample input will be like,
emails[] = '[email protected]',
emails[] = '[email protected]',
I gave the validation rule like,
'emails' => 'required|email'
But when I give more than one values, it returns email invalid error because the email input is array. How can I validate this? Should I write custom rule?
Based on this answer I have tried something like,
$validator->each('emails', 'required|email')
But not working.
$validator->each('emails', 'required|email')
. Still not working. – Joel James