|null legacy order id => local order id */ private static ?array $map = null; public function resolve(int $whmcsOrderId): ?int { self::$map ??= DB::table('orders')->whereNotNull('legacy_id')->pluck('id', 'legacy_id')->all(); return self::$map[$whmcsOrderId] ?? null; } }