mercredi 27 décembre 2017

Validating array fields based on index in Laravel 5.4

I have two arrays in my request:

from = ["Dec 24,2017",.....]
to   = ["Dec 21,2017",....]

And I have added rules in Laravel Validator for them

'from.*' => 'required',
'to.*' => 'required',

But now I have to add a new validation rule. The first element in "from" must be less than or equal to first element in "to", and respectively for other elements in the arrays.

from[0] <= to[0];
from[1] <= to[1];

Any help is appreciated.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2zBMys1
via IFTTT

Aucun commentaire:

Enregistrer un commentaire