settings = Cache::remember( 'website_settings', now()->addMinutes(5), fn () => Schema::hasTable('website_settings') ? WebsiteSetting::all()->pluck('value', 'key') : collect() ); } catch (Throwable) { $this->settings = collect(); } } public function getOrDefault(string $settingName, ?string $default = null): string { if (! $this->settings instanceof Collection) { return (string) $default; } return (string) $this->settings->get($settingName, $default); } public function refresh(): void { Cache::forget('website_settings'); try { $this->settings = Cache::remember( 'website_settings', now()->addMinutes(5), fn () => Schema::hasTable('website_settings') ? WebsiteSetting::all()->pluck('value', 'key') : collect() ); } catch (Throwable) { $this->settings = collect(); } } }