@push('styles') @endpush @php use App\Enums\BillingCycle; use App\Models\SubscriptionPlan; $lpPlans = SubscriptionPlan::query() ->where('status', true) ->orderBy('sort_order') ->with(['features', 'prices']) ->get(); $lpFeatured = $lpPlans->firstWhere('is_featured', true); $lpOthers = $lpPlans->where('is_featured', false)->values(); // Featured plan goes in the centre slot if ($lpFeatured && $lpOthers->count() >= 2) { $lpOrdered = [$lpOthers[0], $lpFeatured, $lpOthers[1]]; } elseif ($lpFeatured && $lpOthers->count() === 1) { $lpOrdered = [$lpOthers[0], $lpFeatured]; } else { $lpOrdered = $lpPlans->all(); } $locale = $locale ?? app()->getLocale(); $lpEyebrow = !empty($data['subheading'][$locale]) ? $data['subheading'][$locale] : __('Simple, transparent pricing'); $lpHeading = !empty($data['heading'][$locale]) ? $data['heading'][$locale] : __('Pick the plan that powers your wallet'); $lpDesc = !empty($data['description'][$locale]) ? $data['description'][$locale] : __('All plans include a :site wallet. Upgrade anytime — no hidden fees, no lock-in.', ['site' => setting('site_title', config('app.name'))]); $allPrices = $lpPlans->flatMap->prices; $maxHalfYearlyDiscount = $allPrices->where('billing_cycle', BillingCycle::HalfYearly)->max('discount'); $maxYearlyDiscount = $allPrices->where('billing_cycle', BillingCycle::Yearly)->max('discount'); $currencyCode = siteCurrency('code'); @endphp
{{-- Background orbs --}} {{-- Section header --}}
{{ $lpEyebrow }}

{!! nl2br(e($lpHeading)) !!}

{{ $lpDesc }}

{{-- 3-cycle billing toggle --}}
{{-- Plans grid --}}
@foreach($lpOrdered as $lpIdx => $lpPlan) @php $isFeatured = $lpPlan->is_featured; $prices = $lpPlan->prices->keyBy( fn($p) => $p->billing_cycle instanceof BillingCycle ? $p->billing_cycle->value : (string) $p->billing_cycle ); $monthlyRow = $prices['monthly'] ?? null; $halfRow = $prices['half_yearly'] ?? null; $yearlyRow = $prices['yearly'] ?? null; $monthlyAmt = (float) ($monthlyRow?->price ?? 0); $halfAmt = (float) ($halfRow?->price ?? 0); $yearlyAmt = (float) ($yearlyRow?->price ?? 0); $isFree = $monthlyAmt <= 0; $halfPerMo = $halfAmt > 0 ? round($halfAmt / 6, 2) : 0; $yearPerMo = $yearlyAmt > 0 ? round($yearlyAmt / 12, 2) : 0; $halfNote = $halfRow?->discount ? __(':d% off — :c:a billed every 6 months', ['d' => $halfRow->discount, 'c' => $currencyCode, 'a' => number_format($halfAmt, siteDecimalPlaces())]) : ($halfAmt > 0 ? __(':c:a billed every 6 months', ['c' => $currencyCode, 'a' => number_format($halfAmt, siteDecimalPlaces())]) : ''); $yearNote = $yearlyRow?->discount ? __(':d% off — :c:a billed yearly', ['d' => $yearlyRow->discount, 'c' => $currencyCode, 'a' => number_format($yearlyAmt, siteDecimalPlaces())]) : ($yearlyAmt > 0 ? __(':c:a billed yearly', ['c' => $currencyCode, 'a' => number_format($yearlyAmt, siteDecimalPlaces())]) : ''); $planIcon = match(true) { $isFree => 'fas fa-seedling', $isFeatured => 'fas fa-crown', default => 'fas fa-rocket', }; if ($isFree) { $badgeVariant = 'free'; $badgeText = $lpPlan->plan_badge ?: __('Free Forever'); } elseif ($isFeatured) { $badgeVariant = 'featured'; $badgeText = $lpPlan->plan_badge ?: __('Most Popular'); } elseif ($lpPlan->plan_badge) { $badgeVariant = 'pro'; $badgeText = $lpPlan->plan_badge; } else { $badgeVariant = null; $badgeText = null; } if ($isFree) { $ctaLabel = __('Get Started — Free'); } elseif ($lpPlan->trial_days > 0) { $ctaLabel = __('Start :d-Day Free Trial', ['d' => $lpPlan->trial_days]); } else { $ctaLabel = __('Get :name', ['name' => $lpPlan->name]); } @endphp
@if($isFeatured) @endif {{-- Plan identity --}}
@if($badgeText) @if($isFeatured) @endif {{ $badgeText }} @endif
{{ $lpPlan->name }}
{{ $lpPlan->description ?: __('Access to core platform features.') }}
{{-- Price --}}
@if($isFree) {{ __('Free') }} {{ __('forever') }} @else {{ $currencyCode }} {{ number_format($monthlyAmt, siteDecimalPlaces()) }} /{{ __('mo') }} @endif
 
{{-- Trial pill --}} @if($lpPlan->trial_days > 0)
{{ $lpPlan->trial_days }}-{{ __('day free trial') }}
@endif {{-- CTA --}} {{ $ctaLabel }} @if(! $isFree) @endif
{{-- Features --}} @if($lpPlan->features->isNotEmpty())
{{ __("What's included") }}
    @foreach($lpPlan->features as $lpFeat)
  • {{ $lpFeat->feature_label }} @if(! $lpFeat->isToggle()) {{ $lpFeat->isUnlimited() ? __('Unlimited') : $lpFeat->feature_value }} @endif
  • @endforeach
@endif
@endforeach
@push('scripts') @endpush