0

I'm using Respect\Validation for validate fields. Some of my fields are not mandatory, as the phone number, but if they are not empty they must be validated. Following my current code:

v::Phone()->validate($phoneNumber); // it should return true if $phoneNumber is empty

How to do it?

0

1 Answer 1

1

Based on the docs, it looks like it should be:

v::optional(v::Phone())->validate($phoneNumber);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.