1212use PHPViet \Laravel \Validation \Rules \IpVN ;
1313use PHPViet \Laravel \Validation \Rules \MobileVN ;
1414use PHPViet \Laravel \Validation \Rules \LandLineVN ;
15- use Illuminate \Contracts \Support \DeferrableProvider ;
1615use Illuminate \Support \ServiceProvider as BaseServiceProvider ;
1716
1817/**
1918 * @author Vuong Minh <vuongxuongminh@gmail.com>
2019 * @since 1.0.0
2120 */
22- class ServiceProvider extends BaseServiceProvider implements DeferrableProvider
21+ class ServiceProvider extends BaseServiceProvider
2322{
2423 public function boot (): void
2524 {
@@ -30,15 +29,17 @@ public function boot(): void
3029 protected function loadTrans (): void
3130 {
3231 $ this ->publishes ([
33- __DIR__ . '/../resources/lang ' => resource_path ('lang/vendor/phpVietValidation ' ),
32+ __DIR__ . '/../resources/lang ' => resource_path ('lang/vendor/phpVietValidation ' ),
3433 ]);
35- $ this ->loadTranslationsFrom (__DIR__ . '/../resources/lang/ ' , 'phpVietValidation ' );
34+ $ this ->loadTranslationsFrom (__DIR__ . '/../resources/lang/ ' , 'phpVietValidation ' );
3635 }
3736
3837 protected function loadExt (): void
3938 {
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+ }
4243 }
4344 }
4445
@@ -54,8 +55,4 @@ protected function getCallableRules(): array
5455 ];
5556 }
5657
57- public function provides (): array
58- {
59- return ['validator ' ];
60- }
6158}
0 commit comments