In% with both 4 and 5, we have class Laravel
, which allows specific validations.
By default there are several, such as Validator
, required
, email
, and others.
But I would also like to be able to validate a phone number with ddd .
Example:
$valores = ['telefone' => '(31)9995-5088'];
$rules = ['telefone' => 'required|minha_validacao_de_telefone']
Validator::make($valores, $regras);
How could I do to add a phone validation in same
?
Is there any way to add a regular expression in the validation of Laravel
?