php - Respect\Validation - validate string if not empty, otherwise return true -
i'm using respect\validation validate fields. of fields not mandatory, phone number, if not empty must validated. following current code:
v::phone()->validate($phonenumber); // should return true if $phonenumber empty
how it?
based on the docs, looks should be:
v::optional(v::phone())->validate($phonenumber);
Comments
Post a Comment