From cfcba1bcae3499b21bd1bac6ebc72aaf4b275cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Fri, 18 Feb 2022 12:56:35 +0200 Subject: [PATCH] separated load and publish config --- src/Commands/stubs/scaffold/provider.stub | 29 +++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/Commands/stubs/scaffold/provider.stub b/src/Commands/stubs/scaffold/provider.stub index e63ba0d..b4ea49b 100644 --- a/src/Commands/stubs/scaffold/provider.stub +++ b/src/Commands/stubs/scaffold/provider.stub @@ -7,6 +7,17 @@ use Illuminate\Support\ServiceProvider as Provider; class $NAME$ extends Provider { + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->loadConfig(); + $this->loadRoutes(); + } + /** * Boot the application events. * @@ -14,7 +25,7 @@ class $NAME$ extends Provider */ public function boot() { - $this->loadConfig(); + $this->publishConfig(); $this->loadViews(); $this->loadViewComponents(); $this->loadTranslations(); @@ -22,29 +33,27 @@ class $NAME$ extends Provider } /** - * Register the service provider. + * Load config. * * @return void */ - public function register() + protected function loadConfig() { - $this->loadRoutes(); + $this->mergeConfigFrom( + __DIR__ . '/../$PATH_CONFIG$/config.php', '$ALIAS$' + ); } /** - * Load config. + * Publish config. * * @return void */ - protected function loadConfig() + protected function publishConfig() { $this->publishes([ __DIR__ . '/../$PATH_CONFIG$/config.php' => config_path('$ALIAS$.php'), ], 'config'); - - $this->mergeConfigFrom( - __DIR__ . '/../$PATH_CONFIG$/config.php', '$ALIAS$' - ); } /**