Skip to content

Commit

Permalink
fixes installation when the database is not present
Browse files Browse the repository at this point in the history
  • Loading branch information
core45 committed Aug 7, 2023
1 parent 5710192 commit bf8120f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
],
"minimum-stability": "dev",
"require": {},
"version": "0.1.4"
"version": "0.1.5"
}
27 changes: 16 additions & 11 deletions src/SystemSettingsDBServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,22 @@ public function register(): void

public function boot(): void
{
if (Schema::hasTable('system_settings')) {
config([
'system-settings' => Cache::remember('system-settings', config('system-settings-db.cache-ttl') ?? 60, function () {
return SystemSetting::all(['key','value'])
->keyBy('key')
->transform(function ($setting) {
return $setting->value;
})
->toArray();
})
]);
try {
if (Schema::hasTable('system_settings')) {
config([
'system-settings' => Cache::remember('system-settings', config('system-settings-db.cache-ttl') ?? 60, function () {
return SystemSetting::all(['key','value'])
->keyBy('key')
->transform(function ($setting) {
return $setting->value;
})
->toArray();
})
]);
}
}
catch (\Exception $e) {
// Do nothing
}


Expand Down

0 comments on commit bf8120f

Please sign in to comment.