I use laravel 5.6 and I try to use validate to check my input.
But I have an issue with required_without.
I have 4 input : heure_bureau / heure_supp_bureau / heure_terrain / heure_supp_terrain
I must fill one input at least. So if I fill heure_bureau, the others aren't necessary.
So I use this code :
$validator = \Validator::make($request->all(), [
'heures_bureau' => 'nullable|date_format:"H\hi"|required_without:heures_supp_bureau,heures_terrain,heures_supp_terrain|before:07h45',
'heures_supp_bureau' => 'nullable|date_format:"H\hi"|required_without:heures_bureau,heures_terrain,heures_supp_terrain|before:13h15',
'heures_terrain' => 'nullable|date_format:"H\hi"|required_without:heures_bureau,heures_supp_bureau,heures_supp_terrain|before:07h45',
'heures_supp_terrain' => 'nullable|date_format:"H\hi"|required_without:heures_bureau,heures_supp_bureau,heures_terrain|before:13h15'
], $messages);
But it doesn't work. I have an error for each other input when I fill one. If I use requried_without with only one input, it work well but not when I use it with multiple inputs.
Where am I wrong ?
Thank for your help !