🆙 More fixes 🆙

This commit is contained in:
Remco
2026-01-19 17:32:44 +01:00
parent 3f9e928952
commit 521f9c884c
6 changed files with 46 additions and 30 deletions
+11 -7
View File
@@ -10,15 +10,17 @@ use Throwable;
class SettingsService
{
public ?Collection $settings;
public private(set) ?Collection $settings;
public function __construct()
{
try {
$this->settings = Cache::remember(
'website_settings',
now()->addMinutes(5),
fn () => Schema::hasTable('website_settings') ? WebsiteSetting::all()->pluck('value', 'key') : collect()
key: 'website_settings',
ttl: now()->addMinutes(5),
callback: fn () => Schema::hasTable('website_settings')
? WebsiteSetting::all()->pluck('value', 'key')
: collect()
);
} catch (Throwable) {
$this->settings = collect();
@@ -40,9 +42,11 @@ class SettingsService
try {
$this->settings = Cache::remember(
'website_settings',
now()->addMinutes(5),
fn () => Schema::hasTable('website_settings') ? WebsiteSetting::all()->pluck('value', 'key') : collect()
key: 'website_settings',
ttl: now()->addMinutes(5),
callback: fn () => Schema::hasTable('website_settings')
? WebsiteSetting::all()->pluck('value', 'key')
: collect()
);
} catch (Throwable) {
$this->settings = collect();