Skip to content

Commit cfcba1b

Browse files
authored
separated load and publish config
1 parent 3dd5184 commit cfcba1b

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

src/Commands/stubs/scaffold/provider.stub

+19-10
Original file line numberDiff line numberDiff line change
@@ -7,44 +7,53 @@ use Illuminate\Support\ServiceProvider as Provider;
77

88
class $NAME$ extends Provider
99
{
10+
/**
11+
* Register the service provider.
12+
*
13+
* @return void
14+
*/
15+
public function register()
16+
{
17+
$this->loadConfig();
18+
$this->loadRoutes();
19+
}
20+
1021
/**
1122
* Boot the application events.
1223
*
1324
* @return void
1425
*/
1526
public function boot()
1627
{
17-
$this->loadConfig();
28+
$this->publishConfig();
1829
$this->loadViews();
1930
$this->loadViewComponents();
2031
$this->loadTranslations();
2132
$this->loadMigrations();
2233
}
2334

2435
/**
25-
* Register the service provider.
36+
* Load config.
2637
*
2738
* @return void
2839
*/
29-
public function register()
40+
protected function loadConfig()
3041
{
31-
$this->loadRoutes();
42+
$this->mergeConfigFrom(
43+
__DIR__ . '/../$PATH_CONFIG$/config.php', '$ALIAS$'
44+
);
3245
}
3346

3447
/**
35-
* Load config.
48+
* Publish config.
3649
*
3750
* @return void
3851
*/
39-
protected function loadConfig()
52+
protected function publishConfig()
4053
{
4154
$this->publishes([
4255
__DIR__ . '/../$PATH_CONFIG$/config.php' => config_path('$ALIAS$.php'),
4356
], 'config');
44-
45-
$this->mergeConfigFrom(
46-
__DIR__ . '/../$PATH_CONFIG$/config.php', '$ALIAS$'
47-
);
4857
}
4958

5059
/**

0 commit comments

Comments
 (0)