gabrielapg/validador-cpf-laravel

Validation CPF support in your Laravel application version Laravel 5.4

dev-master 2018-02-14 01:29 UTC

This package is not auto-updated.

Last update: 2022-01-08 15:21:03 UTC


README

Validation CPF for Laravel 5.4

Composer required

composer require "gabrielapg/validador-cpf-laravel @dev"

Register your provider

Insert in file config/app.php

ValidationCPF\CpfServiceProvider::class

Publish

php artisan vendor:publish

Change message error

In file config/cpf.php your change message error

Example

namespace App\Http\Requests;

use App\Http\Requests\Request;

class ExampleRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'cpf' => 'cpf'
        ];
    }
}

Or if you prefer you can do:

$this->validate($request, [
    'cpf' => 'cpf',
]);

References fork

This package is an original fork of:

jailtonsc/validador-cpf-laravel