I have two input date in a form, one of them is start_date and the other is end_date and I am trying to do a validation that verifies that end_date is required if start_date has already been entered.
I did that part, but now I can't add the other checks because it doesn't work as it should. If I use "date_format: Y-m-d" the field always becomes required.
If I want to use "after_or_equal:" then the field always returns error if start_date is null.
return [
"start_date" => "nullable|date_format:Y-m-d",
"end_date" => new RequiredIf($this->start_date !== NULL).'|date_format:Y-m-d|after_or_equal:start_date',
];
That is my validator, if I delete the validation of the "date_format" and "after_or_equal" it works, but I need to validate all those data