@extends('user.user_dashboard') @section('home') @php $id = Auth::user()->id; $profileData = App\Models\User::find($id); // Get the latest active subscription if it exists $subscription = $profileData ->subscriptions() ->where('status', 'active') ->where('end_date', '>', now()) ->latest() ->first(); $today = now(); $purchase = $profileData ->purchases() ->where('status', 'active') ->where('product_id', $product->id) // Assuming purchases have a product_id column ->first(); @endphp
Dashboard
Home / Dashboard
{{-- Enhanced Study --}} @if ($product->enhanced_study == null) @elseif ($purchase) Continue to Enhanced Study @else @if ($subscription && $subscription->level_id == 10) Continue to Enhanced Study @else Subscribe to Access Enhanced Study @endif @endif {{-- End Enhanced Study --}}

{{ $product->product_name }}

{{ $product->product_subtitle }}
{{ $product->short_description }}
Tags
@php $tags = explode(',', $product->product_tags); @endphp @foreach ($tags as $tag) {{ ucfirst($tag) }}   @endforeach
@if ((!$product->read_ebook && !$product->listen_audiobook) ) @else
Access Level
@foreach ($product->levels as $level) {{ $level->level_name }} @if ($level->id != 7) Subscription @endif @if (!$loop->last)   @endif
@endforeach
@endif
{{-- subscription --}}
@if (!$product->enhanced_study) @elseif ($purchase) You Do Not Have an Active Subscription
@else {{-- subscribed uers --}} @if ($subscription) You have an active Subscription
{{-- unsubscribed users --}} @else {{-- subscribe to Access Enhanced Study --}} @if ($product->enhanced_study) Subscribe to Access
Enhanced Study
@endif @endif @endif
{{-- end subscribe to access enhanced study read and listen --}} {{-- purchase EBook --}} {{-- end Purchase EBook --}} {{-- Purchase Print Book --}}
@if ($product->available_in_print == null) @else @endif
{{-- End Purchase Print Book --}}
@endsection