This repository contains useful Laravel validation rules for Guatemalan documents:
You can install the package via composer:
composer require softlogic-gt/laravel-validation-rules-gt
The package will automatically register itself.
If you wish to edit the package translations, you can run the following command to publish them into your resources/lang
folder
php artisan vendor:publish --provider="SoftlogicGT\ValidationRulesGT\ValidationRulesGTServiceProvider"
Determine if the field under validation is a valid Guatemalan DPI.
use SoftlogicGT\ValidationRulesGT\Rules\Dpi;
public function rules()
{
$rules = [
'dpi' => ['required', new Dpi()],
];
$request->validate($rules)
}
Determine if the field under validation is a valid Guatemalan Tax ID (NIT).
use SoftlogicGT\ValidationRulesGT\Rules\Nit;
public function rules()
{
$rules = [
'nit' => ['required', new Nit()],
];
$request->validate($rules)
}