themes how part of site settings
This commit is contained in:
@@ -14,17 +14,21 @@ final class SettingsRepository
|
||||
return $default;
|
||||
}
|
||||
|
||||
/** @var array{value: ?string, type: string}|null $setting */
|
||||
$setting = Cache::rememberForever(
|
||||
"settings.$group.$key",
|
||||
fn (): ?Setting => Setting::query()
|
||||
"settings.value.v2.$group.$key",
|
||||
fn (): ?array => Setting::query()
|
||||
->where([
|
||||
'group' => $group,
|
||||
'key' => $key,
|
||||
])
|
||||
->first()
|
||||
->first(['value', 'type'])
|
||||
?->only(['value', 'type'])
|
||||
);
|
||||
|
||||
return $setting ? $this->decode($setting->value, $setting->type) : $default;
|
||||
return $setting !== null
|
||||
? $this->decode($setting['value'], $setting['type'])
|
||||
: $default;
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
@@ -70,6 +74,8 @@ final class SettingsRepository
|
||||
'registration_label' => 'Get started',
|
||||
'default_meta_title' => '',
|
||||
'default_meta_description' => '',
|
||||
'backend_theme' => config('stylist.default_backend_theme', 'admin'),
|
||||
'frontend_theme' => config('stylist.default_frontend_theme', 'saasland'),
|
||||
];
|
||||
|
||||
return array_replace($defaults, $this->group('site'));
|
||||
@@ -86,7 +92,9 @@ final class SettingsRepository
|
||||
]
|
||||
);
|
||||
|
||||
// Remove both the legacy model cache and the scalar-only cache.
|
||||
Cache::forget("settings.$group.$key");
|
||||
Cache::forget("settings.value.v2.$group.$key");
|
||||
Cache::forget("settings.group.$group");
|
||||
|
||||
return $setting;
|
||||
|
||||
Reference in New Issue
Block a user