@extends('layouts.app') @section('content')
{{--
Reset
--}} @if(session('error'))
{{ session('error') }}
@endif
@forelse($gameList as $game)
{{-- --}}

{{ $game->game_title }}

{{ substr($game->game_description, 0, 100) }}{{ strlen($game->game_description) > 100 ? '...' : '' }}

{{--

{{ \Carbon\Carbon::parse($game->game_start_date)->format('jS F Y') }}

--}}

{{ \Carbon\Carbon::parse($game->game_end_date)->format('jS F Y') }} {{ date('g:i A', strtotime($game->game_end_time)) }}

(Close Date and Time)

{{ \Carbon\Carbon::parse($game->game_draw_date)->format('jS F Y') }} {{ date('g:i A', strtotime($game->game_draw_time)) }}

(Draw Date and Time)
@if($game->featured_image) @else @endif
@php $currentDateTime = \Carbon\Carbon::now('Asia/Kolkata'); // Convert $gameEndDate and $gameEndTime to Carbon objects in IST $gameEndDateTime = \Carbon\Carbon::parse($game->game_end_date . ' ' . $game->game_end_time, 'Asia/Kolkata'); // Check if the game end date and time have expired if ($gameEndDateTime->isFuture()) { // Game end date is in the future, not expired yet if ($gameEndDateTime->isSameDay($currentDateTime)) { // Game end date is today, check the current time if ($gameEndDateTime->isPast()) { // Game end time has passed $buttonLabel = 'Buy Ticket'; } else { // Game end time has not passed $buttonLabel = 'Buy Ticket'; } } else { // Game end date is not today $buttonLabel = 'Buy Ticket'; } } else { // Game end date and time have passed // Convert $gameDrawDate and $gameDrawTime to Carbon objects in IST $gameDrawDateTime = \Carbon\Carbon::parse($game->game_draw_date . ' ' . $game->game_draw_time, 'Asia/Kolkata'); // Check if the game draw date and time have expired if ($gameDrawDateTime->isPast()) { // Game draw date and time have passed $buttonLabel = 'View Result'; } else { // Game draw date and time have not passed $buttonLabel = 'Waiting for Result'; } } @endphp @if(auth()->check()) @if($game->result_publish != 1) @if($buttonLabel === 'Buy Ticket') @elseif($buttonLabel === 'View Result') @elseif($buttonLabel === 'Waiting for Result') @endif @else @endif @endif
@empty
No Active Games Found!
@endforelse
{{--
--}} @endsection