Skip to content

Commit 13d0ff3

Browse files
Another attempt
1 parent 72577a0 commit 13d0ff3

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

app/Foundation/Providers/ConfigServiceProvider.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,19 @@ public function boot()
3838
$cache = $this->app->make(Cache::class);
3939
$loaded = $cache->load($env);
4040

41-
$this->app->terminating(function () use ($env, $repo, $cache, $loaded) {
42-
if ($repo->stale() || $loaded === false) {
43-
$cache->store($env, $repo->all());
41+
$this->app->terminating(function () use ($repo, $cache) {
42+
if ($repo->stale()) {
43+
$cache->clear();
4444
}
4545
});
4646

4747
try {
48-
// Get the default settings.
49-
$defaultSettings = $this->app->config->get('setting');
50-
51-
// Get the configured settings.
52-
$appSettings = $loaded === false ? $repo->all() : $loaded;
48+
if ($loaded === false) {
49+
$loaded = $repo->all();
50+
$cache->store($env, $loaded);
51+
}
5352

54-
// Merge the settings
55-
$settings = array_merge($defaultSettings, $appSettings);
53+
$settings = array_merge($this->app->config->get('setting'), $loaded);
5654

5755
$this->app->config->set('setting', $settings);
5856
} catch (Exception $e) {

0 commit comments

Comments
 (0)