I want to allow users to leave the email and phone blank on the register function. I also want any added emails or phones no. to be unique. However the isUnique function in the build rules is stopping this because it sees that the blank field already exists.
public function buildRules(RulesChecker $rules)
{
$rules->add($rules->isUnique(['username']));
$rules->add($rules->isUnique(['email']));
$rules->add($rules->isUnique(['phone']));
return $rules;
}
How can I remedy this? I have already tried the ->allowEmpty in the validation but it doesn't work. There is nothing about this in the documents. As specific as this.