@extends(getTemplate().'.view.layout.layout') @section('title') {{ get_option('site_title','') }} - My Subscription @endsection @section('meta_description',get_option('site_meta_description')) @section('meta_keyword',get_option('site_meta_keyword')) @section('style') @parent @endsection @section('page') @php $subscriptionSettings = \App\Models\SubscriptionSetting::first(); $monthlySubscriptionPrice = $subscriptionSettings && $subscriptionSettings->monthly_subscription_price ? (float) $subscriptionSettings->monthly_subscription_price : 15000; $yearlySubscriptionPrice = $subscriptionSettings && $subscriptionSettings->yearly_subscription_price ? (float) $subscriptionSettings->yearly_subscription_price : $monthlySubscriptionPrice * 10; $hasYearlyPlan = !empty(get_paystack_plan_code_yearly()); $limitedMonthlyPrice = $subscriptionSettings ? (float) ($subscriptionSettings->limited_monthly_price ?: 0) : 0; $limitedYearlyPrice = $subscriptionSettings ? (float) ($subscriptionSettings->limited_yearly_price ?: 0) : 0; $hasLimitedPlan = !empty(get_limited_plan_code()) || !empty(get_limited_plan_code_yearly()); $hasLimitedYearly = !empty(get_limited_plan_code_yearly()); $starterMonthlyPrice = $subscriptionSettings ? (float) ($subscriptionSettings->starter_monthly_price ?: 0) : 0; $starterYearlyPrice = $subscriptionSettings ? (float) ($subscriptionSettings->starter_yearly_price ?: 0) : 0; $hasStarterPlan = !empty(get_starter_plan_code()) || !empty(get_starter_plan_code_yearly()); $hasStarterYearly = !empty(get_starter_plan_code_yearly()); $user = Auth::user(); $emailUsername = explode('@', $user->email)[0]; if (strpos($emailUsername, '.') !== false) { $nameParts = explode('.', $emailUsername, 2); $firstName = ucfirst($nameParts[0]); $lastName = ucfirst($nameParts[1]); } elseif (strpos($emailUsername, '_') !== false) { $nameParts = explode('_', $emailUsername, 2); $firstName = ucfirst($nameParts[0]); $lastName = ucfirst($nameParts[1]); } else { $nameLen = strlen($emailUsername); $splitPos = max(1, (int)floor($nameLen * 0.45)); $firstName = ucfirst(substr($emailUsername, 0, $splitPos)); $lastName = ucfirst(substr($emailUsername, $splitPos)); } $phoneLast10 = $user->phone ? substr($user->phone, -10) : ''; $monthlyPaymentUrl = get_paystack_plan_code() ? get_paystack_plan_payment_url(get_paystack_plan_code(), $user->email, $firstName, $lastName, $phoneLast10) : null; $yearlyPaymentUrl = get_paystack_plan_code_yearly() ? get_paystack_plan_payment_url(get_paystack_plan_code_yearly(), $user->email, $firstName, $lastName, $phoneLast10) : null; $limitedMonthlyPaymentUrl = get_limited_plan_code() ? get_limited_plan_url(get_limited_plan_code(), $user->email, $firstName, $lastName, $phoneLast10) : null; $limitedYearlyPaymentUrl = get_limited_plan_code_yearly() ? get_limited_plan_url(get_limited_plan_code_yearly(), $user->email, $firstName, $lastName, $phoneLast10) : null; $starterMonthlyPaymentUrl = get_starter_plan_code() ? get_starter_plan_url(get_starter_plan_code(), $user->email, $firstName, $lastName, $phoneLast10) : null; $starterYearlyPaymentUrl = get_starter_plan_code_yearly() ? get_starter_plan_url(get_starter_plan_code_yearly(), $user->email, $firstName, $lastName, $phoneLast10) : null; @endphp

My Subscription

@if($activeSubscription)

Active Subscription

Plan: {{ $activeSubscription->tier->name ?? ($activeSubscription->isUnlimited() ? 'All-Access' : ($activeSubscription->isStarter() ? 'Starter Plan' : '10-Course Plan')) }}

Type: @if($activeSubscription->isUnlimited()) Unlimited @else {{ $activeSubscription->isStarter() ? 'Starter' : 'Limited' }} ({{ $activeSubscription->courses_allocated }} courses) @endif

@if($activeSubscription->isLimited())

Courses Used: {{ $activeSubscription->courses()->count() }} / {{ $activeSubscription->courses_allocated }}

@endif

Status: {{ ucfirst($activeSubscription->status) }}

Billing Cycle: {{ ucfirst($activeSubscription->billing_cycle) }}

Started: {{ $activeSubscription->starts_at->format('F j, Y') }}

Ends: {{ $activeSubscription->ends_at->format('F j, Y') }}

@if($activeSubscription->isLimited())
Upgrade Available: You're on the {{ $activeSubscription->courses_allocated }}-course plan. Upgrade to unlimited to access all courses!
@csrf
@endif
⚠️ Warning: If you cancel your subscription, you will not be able to resubscribe. To access new courses after cancellation, you will need to purchase each course individually.
@csrf
@else

Choose Your Plan

Pick the plan that best fits your learning goals

@if($hasStarterPlan && $starterMonthlyPrice > 0)
🌟
Starter Plan
Pick any 3 courses to get started!
{{ currencySign() . number_format($starterMonthlyPrice) }} /month
@if($hasStarterYearly && $starterYearlyPrice > 0)
or {{ currencySign() . number_format($starterYearlyPrice) }}/year SAVE 15%
@endif
  • ✓ 3 courses of your choice
  • ✓ Full access to all projects
  • ✓ Free access to instructors
  • ✓ Perfect for beginners
@if($starterMonthlyPaymentUrl) @else @endif @if($hasStarterYearly && $starterYearlyPaymentUrl) @endif
@endif @if($hasLimitedPlan && $limitedMonthlyPrice > 0)
📘
10-Course Plan
Gain access to any 10 courses of your choice!
{{ currencySign() . number_format($limitedMonthlyPrice) }} /month
@if($hasLimitedYearly && $limitedYearlyPrice > 0)
or {{ currencySign() . number_format($limitedYearlyPrice) }}/year SAVE 15%
@endif
  • ✓ 10 courses free!
  • ✓ Full access to all its projects
  • ✓ Free access to instructors anytime
  • ✓ Full access to add courses
@if($limitedMonthlyPaymentUrl) @else @endif @if($hasLimitedYearly && $limitedYearlyPaymentUrl) @endif
@endif
@endif

Subscription History

@if($subscriptionHistory->count() > 0) @foreach($subscriptionHistory as $subscription) @endforeach
Plan Type Status Billing Cycle Started Ended Cancelled At
{{ $subscription->tier->name ?? ($subscription->plan_type === 'limited' ? '10-Course Plan' : ($subscription->plan_type === 'starter' ? 'Starter Plan' : 'All-Access')) }} @if($subscription->plan_type === 'limited') Limited @elseif($subscription->plan_type === 'starter') Starter @else Unlimited @endif @if($subscription->status == 'active') {{ ucfirst($subscription->status) }} @elseif($subscription->status == 'cancelled') {{ ucfirst($subscription->status) }} @elseif($subscription->status == 'expired') {{ ucfirst($subscription->status) }} @else {{ ucfirst($subscription->status) }} @endif {{ ucfirst($subscription->billing_cycle) }} {{ $subscription->starts_at ? $subscription->starts_at->format('F j, Y') : 'N/A' }} {{ $subscription->ends_at ? $subscription->ends_at->format('F j, Y') : 'N/A' }} {{ $subscription->cancelled_at ? $subscription->cancelled_at->format('F j, Y') : 'N/A' }}
@else

No subscription history found.

@endif
@endsection