I think you are better of creating a custom validator, where you check if end_timie is after start_time etc.
Date range validation
Hi,
Currently I have a model called Lesson and as expected I have fields such as
teacher_id start_time end_time day_of_week (i.e. Wednesday, Friday)
Using Model based validation solutions such as Laravel validating as well as Laravel Administrator. I'm required to have a $rules variables defining the validation rules in my models and admin config files.
My question is therefore, how do I specify validation rules such as end_time always be after start_time, the date range start_time and end_time does not clash with other lessons created by the same teacher?
The validation docs in Laravel shows something like
$v->sometimes('reason', 'required|max:500', function($input)
{
return $input->games >= 100;
});
However for my case I'm just using a rules variable here. Would like to know the normal way of doing it too with the $v->sometimes option.
Please or to participate in this conversation.