jailtonsc / validador-cnpj-laravel
支持Laravel 5.*的cnpj验证器
v1.0.1
2016-07-30 21:20 UTC
Requires
- php: >=5.5.9
This package is auto-updated.
Last update: 2024-09-11 03:33:17 UTC
README
支持Laravel 5.*的cnpj验证器
Composer安装
composer require jailtonsc/validador-cnpj-laravel
与Laravel的集成
在config/app.php
文件的providers部分中放入
ValidadorCnpj\CnpjServiceProvider::class
发布
php artisan vendor:publish
使用示例
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' ]; } }
或者
$this->validate($request, [ 'cnpj' => 'cnpj', ]);