1 | <?php namespace Arcanesoft\Auth\Providers; |
||
12 | class ValidatorServiceProvider extends ServiceProvider |
||
13 | { |
||
14 | /* ----------------------------------------------------------------- |
||
15 | | Main Methods |
||
16 | | ----------------------------------------------------------------- |
||
17 | */ |
||
18 | |||
19 | /** |
||
20 | * Register the service provider. |
||
21 | */ |
||
22 | 10 | public function register() |
|
23 | { |
||
24 | // |
||
25 | 10 | } |
|
26 | |||
27 | /** |
||
28 | * Boot the service provider. |
||
29 | */ |
||
30 | 10 | public function boot() |
|
31 | { |
||
32 | 10 | $this->registerUserValidators(); |
|
33 | 10 | } |
|
34 | |||
35 | /* ----------------------------------------------------------------- |
||
36 | | Validators |
||
37 | | ----------------------------------------------------------------- |
||
38 | */ |
||
39 | |||
40 | /** |
||
41 | * Register the user validators. |
||
42 | */ |
||
43 | 10 | private function registerUserValidators() |
|
44 | { |
||
45 | 10 | $this->extendValidator( |
|
46 | 10 | 'user_password', |
|
47 | 10 | \Arcanesoft\Auth\Validators\UserValidator::class, |
|
48 | 10 | function($message, $attribute) { |
|
49 | $message = 'auth::validation.user_password'; |
||
50 | |||
51 | return str_replace(':attribute', $attribute, trans($message)); |
||
52 | 10 | } |
|
53 | ); |
||
54 | 10 | } |
|
55 | |||
56 | /* ----------------------------------------------------------------- |
||
57 | | Other Methods |
||
58 | | ----------------------------------------------------------------- |
||
59 | */ |
||
60 | |||
61 | /** |
||
62 | * Get the validator instance. |
||
63 | * |
||
64 | * @return \Illuminate\Validation\Factory |
||
65 | */ |
||
66 | 10 | private function validator() |
|
70 | |||
71 | /** |
||
72 | * Extend validator. |
||
73 | * |
||
74 | * @param string $name |
||
75 | * @param string $class |
||
76 | * @param \Closure|null $replacer |
||
77 | */ |
||
78 | 10 | private function extendValidator($name, $class, Closure $replacer = null) |
|
85 | } |
||
86 |