From 9818cc8a3b8f807fb33b8811b2d3497eda20896d Mon Sep 17 00:00:00 2001 From: Observer <45023046+Observer5@users.noreply.github.com> Date: Mon, 9 May 2022 19:41:25 +0800 Subject: [PATCH] Update ServiceProvider.php --- src/ServiceProvider.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index a10893e..bc5723d 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -2,11 +2,12 @@ namespace Observer\LaravelPdd; use EasyPdd\Foundation\Application as Pdd; +use Illuminate\Contracts\Support\DeferrableProvider; use Illuminate\Foundation\Application as LaravelApplication; use Illuminate\Support\ServiceProvider as LaravelServiceProvider; -class ServiceProvider extends LaravelServiceProvider +class ServiceProvider extends LaravelServiceProvider implements DeferrableProvider { /** * Boot the provider. @@ -15,9 +16,9 @@ public function boot() { $source = realpath(__DIR__.'/config.php'); - if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) { - $this->publishes([$source => config_path('pdd.php')], 'laravel-pdd'); - } + $this->publishes([ + __DIR__ . '/config.php' => config_path('pdd.php') + ], 'config'); $this->mergeConfigFrom($source, 'pdd'); } @@ -31,8 +32,10 @@ public function register() $app = new Pdd(config('pdd')); return $app; }); + } - $this->app->alias(Pdd::class, 'pdd'); - $this->app->alias(Pdd::class, 'easypdd'); + public function provides() + { + return ['EasyPdd']; } -} \ No newline at end of file +}