Validação de cpf, cnpj, cpfcnpj para laravel 5.*
$ composer require eltoninacio/cpfcnpj-laravel
ou
"require": {
"eltoninacio/cpfcnpj-laravel": "2.0.*"
}
$ composer update
Registre o ServiceProvider no array providers
dentro do arquivo config/app.php
:
'providers' => [
// ...
EltonInacio\ValidadorCpfCnpj\CpfCnpjServiceProvider::class
]
$this->validade($request, [
'cpf' => 'cpf',
'cnpj' => 'cnpj',
'cpfcnpj' => 'cpfcnpj'
])
ou
namespace App\Http\Requests;
use App\Http\Requests\Request;
class CpfCnpjRequest 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',
'cnpj' => 'cnpj',
'cpfcnpj' => 'cpfcnpj'
];
}
}