Nov 4, 2022
0
Level 1
prohibited_if validation not working as expected
I have 3 fields I am trying to validate. Province, Role and Users. All 3 fields are multi-select dropdown.
Province and Role fields are required together. If user selects either of these 2 fields they have to select the other field as well.
Users field is required when the Province and Role fields are not filled/selected and vice-versa.
I am using below mentioned rule but it's giving me undesired results.
'provinces' => 'required_with:roles|prohibited_if:users,array',
'roles' => 'required_with:provinces|prohibited_if:users,array',
'users' => 'prohibited_if:provinces,array|prohibited_if:roles,array'
Even if I select all the values from all 3 dropdowns it still passes the validation. What am I missing?
Please or to participate in this conversation.