themes how part of site settings

This commit is contained in:
Mark Gregory
2026-07-28 12:43:19 +01:00
parent eafc5e8063
commit f834328044
12 changed files with 144 additions and 18 deletions
@@ -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;