Skip to content

Commit

Permalink
separated load and publish config
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici authored Feb 18, 2022
1 parent 3dd5184 commit cfcba1b
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src/Commands/stubs/scaffold/provider.stub
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,53 @@ 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.
*
* @return void
*/
public function boot()
{
$this->loadConfig();
$this->publishConfig();
$this->loadViews();
$this->loadViewComponents();
$this->loadTranslations();
$this->loadMigrations();
}

/**
* 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$'
);
}

/**
Expand Down

0 comments on commit cfcba1b

Please sign in to comment.