12
12
use PHPViet \Laravel \Validation \Rules \IpVN ;
13
13
use PHPViet \Laravel \Validation \Rules \MobileVN ;
14
14
use PHPViet \Laravel \Validation \Rules \LandLineVN ;
15
- use Illuminate \Contracts \Support \DeferrableProvider ;
16
15
use Illuminate \Support \ServiceProvider as BaseServiceProvider ;
17
16
18
17
/**
19
18
* @author Vuong Minh <[email protected] >
20
19
* @since 1.0.0
21
20
*/
22
- class ServiceProvider extends BaseServiceProvider implements DeferrableProvider
21
+ class ServiceProvider extends BaseServiceProvider
23
22
{
24
23
public function boot (): void
25
24
{
@@ -30,15 +29,17 @@ public function boot(): void
30
29
protected function loadTrans (): void
31
30
{
32
31
$ this ->publishes ([
33
- __DIR__ . '/../resources/lang ' => resource_path ('lang/vendor/phpVietValidation ' ),
32
+ __DIR__ . '/../resources/lang ' => resource_path ('lang/vendor/phpVietValidation ' ),
34
33
]);
35
- $ this ->loadTranslationsFrom (__DIR__ . '/../resources/lang/ ' , 'phpVietValidation ' );
34
+ $ this ->loadTranslationsFrom (__DIR__ . '/../resources/lang/ ' , 'phpVietValidation ' );
36
35
}
37
36
38
37
protected function loadExt (): void
39
38
{
40
- foreach ($ this ->getCallableRules () as $ name => $ rule ) {
41
- $ this ->app ['validator ' ]->extend ($ name , $ rule , $ rule ->message ());
39
+ if (isset ($ this ->app ['validator ' ])) {
40
+ foreach ($ this ->getCallableRules () as $ name => $ rule ) {
41
+ $ this ->app ['validator ' ]->extend ($ name , $ rule , $ rule ->message ());
42
+ }
42
43
}
43
44
}
44
45
@@ -54,8 +55,4 @@ protected function getCallableRules(): array
54
55
];
55
56
}
56
57
57
- public function provides (): array
58
- {
59
- return ['validator ' ];
60
- }
61
58
}
0 commit comments