cgdsoftware/cnp-validator is a Laravel package for romanian cnp validator for laravel.
It currently has 0 GitHub stars and 5 downloads on Packagist (latest version v2.1.1).
Install it with composer require cgdsoftware/cnp-validator.
Discover more Laravel packages by cgdsoftware
or browse all Laravel packages to compare alternatives.
Last updated
Romanian CNP validator for Laravel
Add 'LaravelLiberu\CnpValidator\CnpValidatorServiceProvider::class' to your providers list in config/app.php.
Use the CNP validator in your ValidateModelRequest validation class
public function rules()
{
return [
'cnp' => [
'max:13',
'cnp',
'nullable',
request()->getMethod() == 'PATCH'
? Rule::unique('users', 'nin')->ignore(route('user')->id)
: Rule::unique('users', 'nin')
],
];
}
Don't forget to add the translation for the validator error message in resources/lang/**/validation.php under the cnp key.
The Laravel Liberu Core package comes with this package included.
are welcome. Pull requests are great, but issues are good too.
This package is released under the MIT license.