@extends('admin.admin_dashboard') @section('admin') @php /* use Carbon\Carbon; $subscriptions = App\Models\Subscription::where('status', 'active') ->where('created_at', '>', Carbon::parse('2025-06-30')->endOfDay()) ->where(function ($query) { $query->whereHas('payment', function ($q) { $q->where('coupon', 'LWFS'); }) ->orWhere(function ($q) { $q->whereHas('user', function ($u) { $u->where('zone', 'LWFS'); })->whereHas('payment', function ($p) { $p->whereNull('coupon'); }); }); }) ->latest() ->get(); */ use Carbon\Carbon; $subscriptions = App\Models\Payment::with(['subscription', 'user']) ->where('purpose', 'subscription') ->where(function ($query) { $query->where(function ($q) { $q->where('coupon', 'LWFS') ->where('created_at', '>', Carbon::parse('2025-06-30')->endOfDay()); })->orWhere(function ($q) { $q->whereNull('coupon') ->where('created_at', '>', Carbon::parse('2025-06-30')->endOfDay()) ->whereHas('user', function ($u) { $u->where('zone', 'LWFS'); }); }); }) ->latest() ->get(); @endphp

LWFS Subscriptions

{{--
--}} @foreach($subscriptions as $key => $subscription) @if($subscription->user) @endif @endforeach
s/n Fullname Subscription_Amount Subscription_Name Subscription_Date Subscription_Duration
{{ $key+1 }} {{ $subscription->user->title }} {{ $subscription->user->firstname }} {{ $subscription->user->surname }} {{ $subscription->total_amount }} {{ $subscription->currency }} {{ $subscription->subscription->subscription_name }} {{ \Carbon\Carbon::parse($subscription->subscription->start_date)->format('Y F jS - h:ia') }} {{ $subscription->subscription->subscription_duration }}
@endsection