Invoice::where('invoice_number', $number)->exists(), default => Order::where('order_num', $number)->exists(), }; } while ($exists); return $number; } /** Number of months a billing_cycle value represents (used for pricing and expires_at math). */ public static function cycleToMonths(?string $cycle): int { return match ($cycle) { 'monthly' => 1, 'quarterly' => 3, 'semi_annually' => 6, 'annually' => 12, 'biennially' => 24, 'triennially' => 36, default => 1, }; } }