pluck('setting_value', 'setting_key')->toArray(); Cache::put(self::$cacheKey, $settings, 3600); // Cache for 1 hour } // Get a setting value by key public static function get($key, $default = null) { $settings = Cache::get(self::$cacheKey, []); return $settings[$key] ?? $default; } // Set a setting value by key public static function set($key, $value) { // Update the database SiteSetting::updateOrCreate(['setting_key' => $key], ['setting_value' => $value]); // Update the cache $settings = Cache::get(self::$cacheKey, []); $settings[$key] = $value; Cache::put(self::$cacheKey, $settings, 3600); // Cache for 1 hour } // Clear the cache public static function clearCache() { Cache::forget(self::$cacheKey); } }