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?

Bob
  • 159
  • 7

1 Answers1

1

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

v::optional(v::Phone())->validate($phoneNumber);
Don't Panic
  • 41,125
  • 10
  • 61
  • 80