Код: Выделить всё
$request->validate([
'title' => 'required',
'description' => 'required',
'date' => [
'required',
new DateFormatRule
],
'closed' => 'nullable',
'time_start' => 'required_if:closed,0',
'time_end' => [
'required_if:closed,0',
new TimeDurationRule($request->time_start)
],
]);
Код: Выделить всё
closedОднако, если я отправлю запрос с закрытием как true, я попаду в свое пользовательское правило TimeDurationRule:
Код: Выделить всё
'time_end' => [
'required_if:closed,0',
new TimeDurationRule($request->time_start)
],
Код: Выделить всё
time_endЕсли я прокомментирую свое пользовательское правило, все будет работать так, как ожидалось.
Спасибо за любые предложения!>
Подробнее здесь: https://stackoverflow.com/questions/607 ... in-laravel
Мобильная версия