Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Hayanno's avatar

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

I'm using datepicker-boostrap, 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

0 likes
0 replies

Please or to participate in this conversation.