value('value'); } catch (\Throwable $error) { error_log('Unable to read the user ISO feature switch: ' . get_class($error)); return self::$cached = false; } return self::$cached = in_array(strtolower(trim((string) $value)), ['1', 'true', 'yes', 'on'], true); } public static function assertEnabled(): void { if (!self::enabled()) { throw new CloudError('用户 ISO 功能当前未开放', 403); } } public static function save(bool $enabled): void { $row = Configurations::where('name', self::CONFIG_KEY)->first(); if ($row === null) { $row = new Configurations(); $row->name = self::CONFIG_KEY; } $row->value = $enabled ? 'true' : 'false'; $row->save(); self::$cached = $enabled; } }