From 3cd6c0f7ccd6e10926814112bfa06182699e738a Mon Sep 17 00:00:00 2001 From: idevakk <219866223+idevakk@users.noreply.github.com> Date: Tue, 2 Dec 2025 11:16:20 -0800 Subject: [PATCH] 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 --- app/Livewire/Dashboard/Pricing.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/Livewire/Dashboard/Pricing.php b/app/Livewire/Dashboard/Pricing.php index b47c05e..83b94c1 100644 --- a/app/Livewire/Dashboard/Pricing.php +++ b/app/Livewire/Dashboard/Pricing.php @@ -157,7 +157,17 @@ class Pricing extends Component { $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(); } /**