@php use App\Models\Game; use App\Models\GameList; use App\Models\Platform; // Construct the title of the main card and counts of games in certain statuses. if (Auth::check() && auth()->user()->username == $user->username) { $cardTitle = 'My List'; // Fetch the users games in 'playing' status and a count of them. $playingGames = GameList::where('user_id', Auth::id())->where('status', 1)->get(); $playingCount = count($playingGames); // Fetch the users games in 'replaying' status and a count of them. $replayingGames = GameList::where('user_id', Auth::id())->where('status', 3)->where('is_replaying', 'Y')->get(); $replayingCount = count($replayingGames); // Fetch the users games in 'continuously playing' status and a count of them. $continuouslyPlayingGames = GameList::where('user_id', Auth::id())->where('status', 2)->get(); $continuouslyPlayingCount = count($continuouslyPlayingGames); // Fetch the users games in 'completed' status and a count of them. $completedGames = GameList::where('user_id', Auth::id())->where('status', 3)->get(); $completedCount = count($completedGames); // Fetch the users games in 'on hold' status and a count of them. $onHoldGames = GameList::where('user_id', Auth::id())->where('status', 4)->get(); $onHoldCount = count($onHoldGames); // Fetch the users games in 'dropped' status and a count of them. $droppedGames = GameList::where('user_id', Auth::id())->where('status', 5)->get(); $droppedCount = count($droppedGames); // Fetch the users games in 'plan to play' status and a count of them. $planToPlayGames = GameList::where('user_id', Auth::id())->where('status', 6)->get(); $planToPlayCount = count($planToPlayGames); } elseif (isset($user)) { $cardTitle = $user->username . '\'s List'; // Fetch the users games in 'playing' status and a count of them. $playingGames = GameList::where('user_id', $user->id)->where('status', 1)->get(); $playingCount = count($playingGames); // Fetch the users games in 'replaying' status and a count of them. $replayingGames = GameList::where('user_id', $user->id)->where('status', 3)->where('is_replaying', 'Y')->get(); $replayingCount = count($replayingGames); // Fetch the users games in 'continuously playing' status and a count of them. $continuouslyPlayingGames = GameList::where('user_id', $user->id)->where('status', 2)->get(); $continuouslyPlayingCount = count($continuouslyPlayingGames); // Fetch the users games in 'completed' status and a count of them. $completedGames = GameList::where('user_id', $user->id)->where('status', 3)->get(); $completedCount = count($completedGames); // Fetch the users games in 'on hold' status and a count of them. $onHoldGames = GameList::where('user_id', $user->id)->where('status', 4)->get(); $onHoldCount = count($onHoldGames); // Fetch the users games in 'dropped' status and a count of them. $droppedGames = GameList::where('user_id', $user->id)->where('status', 5)->get(); $droppedCount = count($droppedGames); // Fetch the users games in 'plan to play' status and a count of them. $planToPlayGames = GameList::where('user_id', $user->id)->where('status', 6)->get(); $planToPlayCount = count($planToPlayGames); } // Fetch an array of all platform names. $platformNames = Platform::pluck('name', 'id')->toArray(); @endphp

{{ $cardTitle }}

{{-- Check to see if the user has any games being played currently. --}} @if (count($playingGames) < 1)

No games are currently being played.

@else @if (Auth::check() && route('games.list.index') == url()->current()) @endif {{-- Go through each of the games the user is playing. --}} @foreach ($playingGames as $game) @php $gameOwnership = $game->ownership; // Fetch the game's platform. foreach ($platformNames as $key => $value) { if ($key == $game->platform_id) { $platformName = $value; } } // Create a data-order attribute for the priority. if (!$game->priority) { $dataOrder = 'data-order="0"'; } elseif ($game->priority == 'Low') { $dataOrder = 'data-order="1"'; } elseif ($game->priority == 'Medium') { $dataOrder = 'data-order="2"'; } elseif($game->priority == 'High') { $dataOrder = 'data-order="4"'; } @endphp @if (Auth::check() && route('games.list.index') == url()->current()) @endif @endforeach
Name Rating Platform Priority Added to List On
{{ $game->name }} {{ $game->rating ?? '-' }} {{ $platformName ?? '-' }} {{ $game->priority ?? '-' }} {{ $game->created_at->format('Y-m-d') }}
@method('DELETE') @csrf
@endif
{{-- Check to see if the user has any games being replayed currently. --}} @if (count($replayingGames) < 1)

No games are currently being replayed.

@else @if (Auth::check() && route('games.list.index') == url()->current()) @endif {{-- Go through each of the games the user is replaying. --}} @foreach ($replayingGames as $game) @php $gameOwnership = $game->ownership; // Fetch the game's platform. foreach ($platformNames as $key => $value) { if ($key == $game->platform_id) { $platformName = $value; } } // Create a data-order attribute for the priority. if (!$game->priority) { $dataOrder = 'data-order="0"'; } elseif ($game->priority == 'Low') { $dataOrder = 'data-order="1"'; } elseif ($game->priority == 'Medium') { $dataOrder = 'data-order="2"'; } elseif($game->priority == 'High') { $dataOrder = 'data-order="4"'; } @endphp @if (Auth::check() && route('games.list.index') == url()->current()) @endif @endforeach
Name Rating Platform Priority Added to List On
{{ $game->name }} {{ $game->rating ?? '-' }} {{ $platformName ?? '-' }} {{ $game->priority ?? '-' }} {{ $game->created_at->format('Y-m-d') }}
@method('DELETE') @csrf
@endif
{{-- Check to see if the user has any continuously playing games. --}} @if (count($continuouslyPlayingGames) < 1)

No games are currently being continuously played.

@else @if (Auth::check() && route('games.list.index') == url()->current()) @endif {{-- Go through each of the games the user is continuously playing. --}} @foreach ($continuouslyPlayingGames as $game) @php $gameOwnership = $game->ownership; // Fetch the game's platform. foreach ($platformNames as $key => $value) { if ($key == $game->platform_id) { $platformName = $value; } } // Create a data-order attribute for the priority. if (!$game->priority) { $dataOrder = 'data-order="0"'; } elseif ($game->priority == 'Low') { $dataOrder = 'data-order="1"'; } elseif ($game->priority == 'Medium') { $dataOrder = 'data-order="2"'; } elseif($game->priority == 'High') { $dataOrder = 'data-order="4"'; } @endphp @if (Auth::check() && route('games.list.index') == url()->current()) @endif @endforeach
Name Rating Platform Priority Added to List On
{{ $game->name }} {{ $game->rating ?? '-' }} {{ $platformName ?? '-' }} {{ $game->priority ?? '-' }} {{ $game->created_at->format('Y-m-d') }}
@method('DELETE') @csrf
@endif
{{-- Check to see if the user has any completed games. --}} @if (count($completedGames) < 1)

No games have been marked as completed.

@else @if (Auth::check() && route('games.list.index') == url()->current()) @endif {{-- Go through each of the games the user has completed. --}} @foreach ($completedGames as $game) @php $gameOwnership = $game->ownership; // Fetch the game's platform. foreach ($platformNames as $key => $value) { if ($key == $game->platform_id) { $platformName = $value; } } // Create a data-order attribute for the priority. if (!$game->priority) { $dataOrder = 'data-order="0"'; } elseif ($game->priority == 'Low') { $dataOrder = 'data-order="1"'; } elseif ($game->priority == 'Medium') { $dataOrder = 'data-order="2"'; } elseif($game->priority == 'High') { $dataOrder = 'data-order="4"'; } @endphp @if (Auth::check() && route('games.list.index') == url()->current()) @endif @endforeach
Name Rating Platform Priority Added to List On
{{ $game->name }} {{ $game->rating ?? '-' }} {{ $platformName ?? '-' }} {{ $game->priority ?? '-' }} {{ $game->created_at->format('Y-m-d') }}
@method('DELETE') @csrf
@endif
{{-- Check to see if the user has any games set to on hold. --}} @if (count($onHoldGames) < 1)

No games have been set to on-hold.

@else @if (Auth::check() && route('games.list.index') == url()->current()) @endif {{-- Go through each of the games the user has on hold. --}} @foreach ($onHoldGames as $game) @php $gameOwnership = $game->ownership; // Fetch the game's platform. foreach ($platformNames as $key => $value) { if ($key == $game->platform_id) { $platformName = $value; } } // Create a data-order attribute for the priority. if (!$game->priority) { $dataOrder = 'data-order="0"'; } elseif ($game->priority == 'Low') { $dataOrder = 'data-order="1"'; } elseif ($game->priority == 'Medium') { $dataOrder = 'data-order="2"'; } elseif($game->priority == 'High') { $dataOrder = 'data-order="4"'; } @endphp @if (Auth::check() && route('games.list.index') == url()->current()) @endif @endforeach
Name Rating Platform Priority Added to List On
{{ $game->name }} {{ $game->rating ?? '-' }} {{ $platformName ?? '-' }} {{ $game->priority ?? '-' }} {{ $game->created_at->format('Y-m-d') }}
@method('DELETE') @csrf
@endif
{{-- Check to see if the user has any dropped games. --}} @if (count($droppedGames) < 1)

No games have been marked as dropped.

@else @if (Auth::check() && route('games.list.index') == url()->current()) @endif {{-- Go through each of the games the user has dropped. --}} @foreach ($droppedGames as $game) @php $gameOwnership = $game->ownership; // Fetch the game's platform. foreach ($platformNames as $key => $value) { if ($key == $game->platform_id) { $platformName = $value; } } // Create a data-order attribute for the priority. if (!$game->priority) { $dataOrder = 'data-order="0"'; } elseif ($game->priority == 'Low') { $dataOrder = 'data-order="1"'; } elseif ($game->priority == 'Medium') { $dataOrder = 'data-order="2"'; } elseif($game->priority == 'High') { $dataOrder = 'data-order="4"'; } @endphp @if (Auth::check() && route('games.list.index') == url()->current()) @endif @endforeach
Name Rating Platform Priority Added to List On
{{ $game->name }} {{ $game->rating ?? '-' }} {{ $platformName ?? '-' }} {{ $game->priority ?? '-' }} {{ $game->created_at->format('Y-m-d') }}
@method('DELETE') @csrf
@endif
{{-- Check to see if the user has games set to plan to play. --}} @if (count($planToPlayGames) < 1)

No games are set to plan to play.

@else @if (Auth::check() && route('games.list.index') == url()->current()) @endif {{-- Go through each of the games the user has set to plan to play. --}} @foreach ($planToPlayGames as $game) @php $gameOwnership = $game->ownership; // Fetch the game's platform. foreach ($platformNames as $key => $value) { if ($key == $game->platform_id) { $platformName = $value; } } // Create a data-order attribute for the priority. if (!$game->priority) { $dataOrder = 'data-order="0"'; } elseif ($game->priority == 'Low') { $dataOrder = 'data-order="1"'; } elseif ($game->priority == 'Medium') { $dataOrder = 'data-order="2"'; } elseif($game->priority == 'High') { $dataOrder = 'data-order="4"'; } @endphp @if (Auth::check() && route('games.list.index') == url()->current()) @endif @endforeach
Name Rating Platform Priority Added to List On
{{ $game->name }} {{ $game->rating ?? '-' }} {{ $platformName ?? '-' }} {{ $game->priority ?? '-' }} {{ $game->created_at->format('Y-m-d') }}
@method('DELETE') @csrf
@endif

Playing

{{-- Check to see if the user has any games being played currently. --}} @if (count($playingGames) < 1)

No games are currently being played.

@else @if (Auth::check() && route('games.list.index') == url()->current()) @endif {{-- Go through each of the games the user is playing. --}} @foreach ($playingGames as $game) @php $gameOwnership = $game->ownership; // Fetch the game's platform. foreach ($platformNames as $key => $value) { if ($key == $game->platform_id) { $platformName = $value; } } // Create a data-order attribute for the priority. if (!$game->priority) { $dataOrder = 'data-order="0"'; } elseif ($game->priority == 'Low') { $dataOrder = 'data-order="1"'; } elseif ($game->priority == 'Medium') { $dataOrder = 'data-order="2"'; } elseif($game->priority == 'High') { $dataOrder = 'data-order="4"'; } @endphp @if (Auth::check() && route('games.list.index') == url()->current()) @endif @endforeach
Name Rating Platform Priority Added to List On
{{ $game->name }} {{ $game->rating ?? '-' }} {{ $platformName ?? '-' }} {{ $game->priority ?? '-' }} {{ $game->created_at->format('Y-m-d') }}
@method('DELETE') @csrf
@endif

Replaying

{{-- Check to see if the user has any games being replayed currently. --}} @if (count($replayingGames) < 1)

No games are currently being replayed.

@else @if (Auth::check() && route('games.list.index') == url()->current()) @endif {{-- Go through each of the games the user is replaying. --}} @foreach ($replayingGames as $game) @php $gameOwnership = $game->ownership; // Fetch the game's platform. foreach ($platformNames as $key => $value) { if ($key == $game->platform_id) { $platformName = $value; } } // Create a data-order attribute for the priority. if (!$game->priority) { $dataOrder = 'data-order="0"'; } elseif ($game->priority == 'Low') { $dataOrder = 'data-order="1"'; } elseif ($game->priority == 'Medium') { $dataOrder = 'data-order="2"'; } elseif($game->priority == 'High') { $dataOrder = 'data-order="4"'; } @endphp @if (Auth::check() && route('games.list.index') == url()->current()) @endif @endforeach
Name Rating Platform Priority Added to List On
{{ $game->name }} {{ $game->rating ?? '-' }} {{ $platformName ?? '-' }} {{ $game->priority ?? '-' }} {{ $game->created_at->format('Y-m-d') }}
@method('DELETE') @csrf
@endif

Continuously Playing

{{-- Check to see if the user has any continuously playing games. --}} @if (count($continuouslyPlayingGames) < 1)

No games are currently being continuously played.

@else @if (Auth::check() && route('games.list.index') == url()->current()) @endif {{-- Go through each of the games the user is continuously playing. --}} @foreach ($continuouslyPlayingGames as $game) @php $gameOwnership = $game->ownership; // Fetch the game's platform. foreach ($platformNames as $key => $value) { if ($key == $game->platform_id) { $platformName = $value; } } // Create a data-order attribute for the priority. if (!$game->priority) { $dataOrder = 'data-order="0"'; } elseif ($game->priority == 'Low') { $dataOrder = 'data-order="1"'; } elseif ($game->priority == 'Medium') { $dataOrder = 'data-order="2"'; } elseif($game->priority == 'High') { $dataOrder = 'data-order="4"'; } @endphp @if (Auth::check() && route('games.list.index') == url()->current()) @endif @endforeach
Name Rating Platform Priority Added to List On
{{ $game->name }} {{ $game->rating ?? '-' }} {{ $platformName ?? '-' }} {{ $game->priority ?? '-' }} {{ $game->created_at->format('Y-m-d') }}
@method('DELETE') @csrf
@endif

Completed

{{-- Check to see if the user has any completed games. --}} @if (count($completedGames) < 1)

No games have been marked as completed.

@else @if (Auth::check() && route('games.list.index') == url()->current()) @endif {{-- Go through each of the games the user has completed. --}} @foreach ($completedGames as $game) @php $gameOwnership = $game->ownership; // Fetch the game's platform. foreach ($platformNames as $key => $value) { if ($key == $game->platform_id) { $platformName = $value; } } // Create a data-order attribute for the priority. if (!$game->priority) { $dataOrder = 'data-order="0"'; } elseif ($game->priority == 'Low') { $dataOrder = 'data-order="1"'; } elseif ($game->priority == 'Medium') { $dataOrder = 'data-order="2"'; } elseif($game->priority == 'High') { $dataOrder = 'data-order="4"'; } @endphp @if (Auth::check() && route('games.list.index') == url()->current()) @endif @endforeach
Name Rating Platform Priority Added to List On
{{ $game->name }} {{ $game->rating ?? '-' }} {{ $platformName ?? '-' }} {{ $game->priority ?? '-' }} {{ $game->created_at->format('Y-m-d') }}
@method('DELETE') @csrf
@endif

On-Hold

{{-- Check to see if the user has any games set to on hold. --}} @if (count($onHoldGames) < 1)

No games have been set to on-hold.

@else @if (Auth::check() && route('games.list.index') == url()->current()) @endif {{-- Go through each of the games the user has on hold. --}} @foreach ($onHoldGames as $game) @php $gameOwnership = $game->ownership; // Fetch the game's platform. foreach ($platformNames as $key => $value) { if ($key == $game->platform_id) { $platformName = $value; } } // Create a data-order attribute for the priority. if (!$game->priority) { $dataOrder = 'data-order="0"'; } elseif ($game->priority == 'Low') { $dataOrder = 'data-order="1"'; } elseif ($game->priority == 'Medium') { $dataOrder = 'data-order="2"'; } elseif($game->priority == 'High') { $dataOrder = 'data-order="4"'; } @endphp @if (Auth::check() && route('games.list.index') == url()->current()) @endif @endforeach
Name Rating Platform Priority Added to List On
{{ $game->name }} {{ $game->rating ?? '-' }} {{ $platformName ?? '-' }} {{ $game->priority ?? '-' }} {{ $game->created_at->format('Y-m-d') }}
@method('DELETE') @csrf
@endif

Dropped

{{-- Check to see if the user has any dropped games. --}} @if (count($droppedGames) < 1)

No games have been marked as dropped.

@else @if (Auth::check() && route('games.list.index') == url()->current()) @endif {{-- Go through each of the games the user has dropped. --}} @foreach ($droppedGames as $game) @php $gameOwnership = $game->ownership; // Fetch the game's platform. foreach ($platformNames as $key => $value) { if ($key == $game->platform_id) { $platformName = $value; } } // Create a data-order attribute for the priority. if (!$game->priority) { $dataOrder = 'data-order="0"'; } elseif ($game->priority == 'Low') { $dataOrder = 'data-order="1"'; } elseif ($game->priority == 'Medium') { $dataOrder = 'data-order="2"'; } elseif($game->priority == 'High') { $dataOrder = 'data-order="4"'; } @endphp @if (Auth::check() && route('games.list.index') == url()->current()) @endif @endforeach
Name Rating Platform Priority Added to List On
{{ $game->name }} {{ $game->rating ?? '-' }} {{ $platformName ?? '-' }} {{ $game->priority ?? '-' }} {{ $game->created_at->format('Y-m-d') }}
@method('DELETE') @csrf
@endif

Plan to Play

{{-- Check to see if the user has games set to plan to play. --}} @if (count($planToPlayGames) < 1)

No games are set to plan to play.

@else @if (Auth::check() && route('games.list.index') == url()->current()) @endif {{-- Go through each of the games the user has set to plan to play. --}} @foreach ($planToPlayGames as $game) @php $gameOwnership = $game->ownership; // Fetch the game's platform. foreach ($platformNames as $key => $value) { if ($key == $game->platform_id) { $platformName = $value; } } // Create a data-order attribute for the priority. if (!$game->priority) { $dataOrder = 'data-order="0"'; } elseif ($game->priority == 'Low') { $dataOrder = 'data-order="1"'; } elseif ($game->priority == 'Medium') { $dataOrder = 'data-order="2"'; } elseif($game->priority == 'High') { $dataOrder = 'data-order="4"'; } @endphp @if (Auth::check() && route('games.list.index') == url()->current()) @endif @endforeach
Name Rating Platform Priority Added to List On
{{ $game->name }} {{ $game->rating ?? '-' }} {{ $platformName ?? '-' }} {{ $game->priority ?? '-' }} {{ $game->created_at->format('Y-m-d') }}
@method('DELETE') @csrf
@endif