lundi 11 janvier 2016

Laravel array field validation

How can I validate an array value in Laravel? 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,

email[] = 'mail0@example.com',
email[] = 'mail1@example.com',

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?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire