lundi 23 novembre 2015

How to validate array of date that have to be inside two other date relative to a model in Laravel 51

I'm using boostrap-datepicker, with "multiple-date" option activated. My "dates" looks like this : [date1, date2,...].

I'm also using an hidden input to retrieve an "id". This "id" help me to retrieve "startdate" and "enddate" inside my model.

So I'm looking for a validation rule who can tell me if my dates are valid and if they are inside two other dates that correspond to the "id" of my model.

For now my "id" and "dates" rules are like this :
$rules = [
'id' => 'required|numeric|exists:event,id,isactive,1',
'dates' => 'array'
]

English is not my native langage, so feel free to correct me or ask me anything.

P.S : I'm using Laravel 5.1



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire