refactor(pricing): optimize plan provider retrieval with active filtering
- Replace getAllowedProviders() method with direct database query - Add filtering for enabled plan providers and active payment providers - Include sort ordering for consistent provider display - Improve performance by using direct database access instead of model method
This commit is contained in:
@@ -157,7 +157,17 @@ class Pricing extends Component
|
|||||||
{
|
{
|
||||||
$plan = $this->plans->firstWhere('id', $planId);
|
$plan = $this->plans->firstWhere('id', $planId);
|
||||||
|
|
||||||
return $plan ? $plan->getAllowedProviders() : [];
|
if (! $plan) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $plan->planProviders()
|
||||||
|
->enabled()
|
||||||
|
->join('payment_providers', 'plan_providers.provider', '=', 'payment_providers.name')
|
||||||
|
->where('payment_providers.is_active', true)
|
||||||
|
->orderBy('plan_providers.sort_order')
|
||||||
|
->pluck('plan_providers.provider')
|
||||||
|
->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user