jailtonsc / validador-cnpj-laravel by jailtonsc

Validador de cnpj com suporte para laravel 5.*
2,842
2
2
Package Data
Maintainer Username: jailtonsc
Maintainer Contact: jailton.dos.santos.cruz@gmail.com (Jailton S. C.)
Package Create Date: 2016-07-30
Package Last Update: 2018-01-12
Language: PHP
License: MIT
Last Refreshed: 2024-11-23 03:09:15
Package Statistics
Total Downloads: 2,842
Monthly Downloads: 62
Daily Downloads: 0
Total Stars: 2
Total Watchers: 2
Total Forks: 1
Total Open Issues: 0

README

Validador de cnpj com suporte para laravel 5.*

Composer Instalação

composer require jailtonsc/validador-cnpj-laravel

Integração com o Laravel

No arquivo config/app.php em providers coloque

ValidadorCnpj\CnpjServiceProvider::class 

publish

php artisan vendor:publish

Modo de usar exemplo

namespace App\Http\Requests;

use App\Http\Requests\Request;

class ArquivoRequest 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 [
            'cnpj' => 'cnpj'
        ];
    }
}

ou

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