where('key', $key)->value('value'); return $value ?? $default; } public static function getInt(string $key, ?int $default = null): ?int { $value = static::get($key, $default); if ($value === null || $value === '') { return $default; } return (int) $value; } public static function set(string $key, mixed $value): void { static::query()->updateOrCreate( ['key' => $key], ['value' => $value === null ? null : (string) $value] ); } }