Tricks

Brazilian CPF Validation

Oct 15, 2022
Leandro C. Ferreira
Form builder, Integration

Installation

To get started with laravellegends/pt-br-validator, you can install it using the command:

composer require laravellegends/pt-br-validator

Validation

You can validate the input by passing cpf validation rule:

use Filament\Forms\Components\TextInput;
 
//cpf
TextInput::make('cpf')
->rule('cpf')
->maxLength(14)
->mask(fn (TextInput\Mask $mask) => $mask->pattern('000.000.000-00')),

No comments yet…