From 3b908484de2db61ef68fa0265dfd3b9c384672e1 Mon Sep 17 00:00:00 2001 From: idevakk <219866223+idevakk@users.noreply.github.com> Date: Tue, 2 Dec 2025 11:44:01 -0800 Subject: [PATCH] refactor(pricing): dynamic payment provider buttons with database-driven text - Replace hardcoded provider-specific buttons with dynamic database-driven approach - Update getPlanProviders() to include display_name from payment_providers table - Simplify plan-card.blade.php with single if/else logic for all providers - Move trial button outside loop and comment for future implementation - Use "Pay with {display_name}" pattern for consistent button text - Maintain special handling for activation_key provider with disabled state --- app/Livewire/Dashboard/Pricing.php | 4 +- .../dashboard/partials/plan-card.blade.php | 42 +++++++------------ 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/app/Livewire/Dashboard/Pricing.php b/app/Livewire/Dashboard/Pricing.php index 83b94c1..975e76f 100644 --- a/app/Livewire/Dashboard/Pricing.php +++ b/app/Livewire/Dashboard/Pricing.php @@ -166,7 +166,9 @@ class Pricing extends Component ->join('payment_providers', 'plan_providers.provider', '=', 'payment_providers.name') ->where('payment_providers.is_active', true) ->orderBy('plan_providers.sort_order') - ->pluck('plan_providers.provider') + ->select('plan_providers.provider', 'payment_providers.display_name') + ->get() + ->keyBy('provider') ->toArray(); } diff --git a/resources/views/livewire/dashboard/partials/plan-card.blade.php b/resources/views/livewire/dashboard/partials/plan-card.blade.php index a8fec54..4573467 100644 --- a/resources/views/livewire/dashboard/partials/plan-card.blade.php +++ b/resources/views/livewire/dashboard/partials/plan-card.blade.php @@ -111,35 +111,21 @@
- @foreach($providers as $provider) - @if($provider === 'stripe') - @if($hasTrial && $trialConfig) - - Start Free Trial - - @endif - - Pay with Card - - @elseif($provider === 'lemon_squeezy') - - Pay with Lemon Squeezy - - @elseif($provider === 'polar') - - Pay with Polar.sh - - @elseif($provider === 'oxapay') - - Pay with OxaPay - - @elseif($provider === 'crypto') - - Pay with Crypto - - @elseif($provider === 'activation_key') + + {{-- @if($hasTrial && $trialConfig) + + Start Free Trial + + @endif --}} + + @foreach($providers as $providerName => $providerData) + @if($providerName === 'activation_key') - Activate via Activation Key + {{ 'Activate via '. $providerData['display_name'] ?? 'Activate via Activation Key' }} + + @else + + Pay with {{ $providerData['display_name'] ?? $providerName }} @endif @endforeach