How can I validate if field end_date is filled, field start_time should be empty? something like: 'start_time' => 'empty_with:end_date'
public function rules()
{
return [
'start_date' => 'required',
'end_date' => 'nullable|after:start_date',
'start_time' => 'empty_with:end_date',
'end_time' => 'required_with:start_time',
];
}
Use the required_without
validation if you want the start_time to be required when end_date is empty
'start_time' => 'required_without:end_date',
The field under validation must be present and not empty only when any of the other specified fields are not present.