Closed shone83 closed 6 years ago
I think your options are:
telephone
is not present in your data array at all, you can declare the unique_with rule for the telephone
attribute like 'telephone_1' => 'unique_with: add_members, name, last_name'
. It will only validate if it is present.telephone
is empty or null, you can check and either remove it from the data array or only add the rule if it is not empty e.g. if (empty($data['telephone_1']) { unset($data['telephone_1']); }
You are right, this helps:
'telephone_1' => 'nullable|unique_with:add_members, name, last_name',
Thanks ;)
I manage to set not to allow these three combination: name, last_name and telephone. The problem is when I want to enter same name and last_name but without telephone (when telephone is empty or null), I need to allow that but in this code it doesn't:
When I make one column unique I use nullable function but here it doesn't work...