'array', ]; /** * Get a setting value by key */ public static function getValue(string $key, $default = null) { $setting = static::where('key', $key)->first(); if (!$setting) { return $default; } // If value is a simple string stored as JSON array, extract it $value = $setting->value; if (is_array($value) && isset($value['value'])) { return $value['value']; } return $value ?? $default; } /** * Set a setting value by key */ public static function setValue(string $key, $value, string $description = null): self { return static::updateOrCreate( ['key' => $key], [ 'value' => is_array($value) ? $value : ['value' => $value], 'description' => $description, ] ); } }