find($key); if (!$row) return $default; $val = $row->value; $decoded = json_decode($val, true); return (json_last_error() === JSON_ERROR_NONE) ? $decoded : $val; } public static function set(string $key, $value): void { $val = is_array($value) ? json_encode($value, JSON_UNESCAPED_SLASHES) : (string)$value; static::query()->updateOrCreate(['key'=>$key], ['value'=>$val]); } public static function signupAllowed() { $value = self::where('key', 'signup_enabled')->value('value'); return is_null($value) || (int) $value === 1; } }