I'm validating a form and if a checkbox is_external_user
has value of 1, I want to make the email
field required and validate the type email
.
Here's my validation rule:
'email' => [
'validation' =>
'required_if:Users.is_external_user,1|email',
],
required_if
is working as expected, but type email
validation returns the error that it is not a valid email address without being required.
Is there working way to use both require_if
and email
rules?