fix: resolve plan selection off-by-one error in activation key generator

This commit is contained in:
idevakk
2025-11-28 07:05:40 -08:00
parent cc34c9aca3
commit 9f45e37693

View File

@@ -56,7 +56,7 @@ class GenerateActivationKeys extends Page implements HasForms, HasTable
->options(function () { ->options(function () {
return Plan::with('planTier') return Plan::with('planTier')
->get() ->get()
->map(function ($plan) { ->mapWithKeys(function ($plan) {
$tierName = $plan->planTier ? $plan->planTier->name : ''; $tierName = $plan->planTier ? $plan->planTier->name : '';
$billingCycle = $plan->getBillingCycleDisplay(); $billingCycle = $plan->getBillingCycleDisplay();
$name = $plan->name; $name = $plan->name;
@@ -68,7 +68,7 @@ class GenerateActivationKeys extends Page implements HasForms, HasTable
$name .= " - {$billingCycle}"; $name .= " - {$billingCycle}";
} }
return $name; return [$plan->id => $name];
}) })
->toArray(); ->toArray();
}) })