In Laravel, I have a Convention object with year, start_date and end_date. The constrain is that the start_date and end_date fields belong to the year field.
I wanna use a request validation, but none of the available rule seem to correspond to my need.
I would like something like this (but it does not work):
class ConventionRequest extends FormRequest
{
public function rules() {
return [
'year' => 'required',
'start_date' => 'required|date|after_or_equal:year-01-01',
'end_date' => 'required|date|before_or_equal:year-12-31']
}
}