-
-
Notifications
You must be signed in to change notification settings - Fork 95
/
ValidatorProvider.php
77 lines (67 loc) · 2.07 KB
/
ValidatorProvider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
namespace geekcom\ValidatorDocs;
use Illuminate\Support\ServiceProvider;
class ValidatorProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$me = $this;
$validatorFormats = new ValidatorFormats();
$this->app['validator']
->resolver(
function ($translator, $data, $rules, $messages, $attributes) use ($me, $validatorFormats) {
$messages += $me->getMessages();
return new Validator($translator, $validatorFormats, $data, $rules, $messages, $attributes);
}
);
}
protected function getMessages()
{
return [
'cnh' => 'Carteira Nacional de Habilitação inválida',
'titulo_eleitor' => 'Título de Eleitor inválido',
'cnpj' => 'CNPJ inválido',
'cpf' => 'CPF inválido',
'renavam' => 'Renavam inválido',
'cpf_cnpj' => 'CPF ou CNPJ inválido',
'nis' => 'PIS/PASEP/NIT/NIS inválido',
'cns' => 'Cartão Nacional de Saúde inválido',
'inscricao_estadual' => 'Inscrição Estadual ou UF inválidas',
'certidao' => 'Número da Certidão inválido',
'ddd' => 'DDD inválido',
'formato_cnpj' => 'Formato inválido para CNPJ',
'formato_cpf' => 'Formato inválido para CPF',
'formato_cpf_cnpj' => 'Formato inválido para CPF ou CNPJ',
'formato_nis' => 'Formato inválido para PIS/PASEP/NIT/NIS',
'formato_certidao' => 'Formato inválido para Certidão',
];
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [];
}
}