laravel-enso / cnp-validator
Romanian CNP validator for Laravel
Installs: 8 904
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 5
Forks: 3
Open Issues: 0
Requires
- php: ^8.1
- laravel/framework: ^9.0|^10.0|^11.0
- dev-master
- 3.2.0
- 3.1.0
- 3.0.0
- 2.1.0
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.13
- 1.3.12
- 1.3.11
- 1.3.10
- 1.3.9
- 1.3.8
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.1
- 1.2.0
- 1.1.9
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-hotfix/typeValidation
- dev-fixes/stylci
This package is auto-updated.
Last update: 2024-11-07 20:44:53 UTC
README
CNP Validator
Romanian CNP validator for Laravel
Instalation Steps
-
Add
'LaravelEnso\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') ], ]; }
Notes
Don't forget to add the translation for the validator error message in resources/lang/**/validation.php
under the cnp
key.
The Laravel Enso Core package comes with this package included.
Contributions
are welcome. Pull requests are great, but issues are good too.
License
This package is released under the MIT license.