{{-- resources/views/expire-subscriptions/index.blade.php --}} @extends('layouts.app') @section('content')
{{-- Header --}}

Expire Subscriptions

Manage and expire subscriptions that have passed their end date

{{-- Alert Messages --}} @if(session('success')) @endif @if(session('error')) @endif {{-- Info Card --}}

Note: This will expire all subscriptions that have passed their end date. Once expired, subscribers will no longer have access to the services until they renew.

{{-- Statistics Cards (Optional) --}} @php use App\Models\Subscription; $expiredCount = Subscription::where('status', 'expired')->count(); $toBeExpiredCount = Subscription::where('status', 'active') ->where('end_date', '<', now()) ->count(); @endphp

Total Active Subscriptions

{{ Subscription::where('status', 'active')->count() }}

To Be Expired

{{ $toBeExpiredCount }}

Already Expired

{{ $expiredCount }}

{{-- Action Cards --}}
{{-- Service Method Card --}}
Using Service Method
Recommended

Expire subscriptions directly using the BillingService. This method provides real-time feedback and detailed logs.

Immediate execution
Detailed response
No command line needed
@csrf
{{-- Artisan Command Card --}}
Using Artisan Command
Advanced

Run the artisan command manually. This method is useful for testing or when you need to run the command from terminal.

Command: php artisan billing:manual-expire
Can be scheduled via cron
@csrf
{{-- Recent Expired Subscriptions --}} @if(isset($recentExpired) && $recentExpired->count() > 0)
Recently Expired Subscriptions
@foreach($recentExpired as $subscription) @endforeach
ID Subscriber Package End Date Status
{{ $subscription->id }} {{ $subscription->subscriber->name }} {{ $subscription->package->name }} {{ $subscription->end_date->format('d M Y') }} Expired
@endif
@endsection @push('styles') @endpush @push('scripts') @endpush