@php use App\Models\Game; use App\Models\GameList; use App\Models\Genre; use App\Models\Platform; // Check to see if the user is logged in. if (Auth::check()) { // Check to see if the user has this game on their list already. $hasGame = GameList::whereUserId(Auth::user()->id)->whereGameId($gameId)->first(); } // Fetch the game object. $game = Game::findOrFail($gameId); // Turn $game->genre_ids into an array. $genres = explode(',', $game->genre_ids); // Determine the friendly genre name(s). $genreNames = []; foreach ($genres as $genre) { array_push($genreNames, Genre::whereId($genre)->value('name')); } // Create a comma separated string of the genre names. $genreNames = implode(', ', $genreNames); // Determine what other platforms this game exists on. $alsoExistsOn = Game::whereName($game->name)->where('id', '!=', $game->id)->get(); $platforms = []; if (count($alsoExistsOn) >= 1) { foreach ($alsoExistsOn as $alsoExistsOnGame) { array_push($platforms, [ 'id' => $alsoExistsOnGame->id, 'name' => Platform::whereId($alsoExistsOnGame->platform_id)->value('name'), ]); } } @endphp

{{ $game->name }}

{{ $game->platform()->get()[0]->name }}
@if (count($errors) > 0)

Error Adding Game to List

    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif @if ($hasGame)

Error Adding Game to List

You already have this game on your list.

@else
@csrf @isset ($game->alt_titles)
The title of the game that will be displayed on your list. If nothing is selected the default title will be used.
@else
@endisset
@endif

Game Information

image
@if ($game->alt_titles) @php $altTitles = str_replace('|', ', ', $game->alt_titles); @endphp
Alternative Titles
{{ $altTitles }}
@endif
Platform
{{ $game->platform()->get()[0]->name }}
Developer(s)
{{ $game->developers ?? '-' }}
Publishers(s)
{{ $game->publishers ?? '-' }}
Genres(s)
{{ $genreNames }}
@if ($game->na_release_date)
NA Release Date
{{ $game->na_release_date }}
@endif @if ($game->jp_release_date)
JP Release Date
{{ $game->jp_release_date }}
@endif @if ($game->eu_release_date)
EU Release Date
{{ $game->eu_release_date }}
@endif @if ($game->aus_release_date)
AUS Release Date
{{ $game->aus_release_date }}
@endif @if ($game->esrb_rating)
ESRB Rating
{{ $game->esrb_rating ?? '-' }}
@endif @if ($game->pegi_rating)
PEGI Rating
{{ $game->pegi_rating ?? '-' }}
@endif @if ($game->cero_rating)
CERO Rating
{{ $game->cero_rating ?? '-' }}
@endif @if ($game->acb_rating)
ACB Rating
{{ $game->acb_rating ?? '-' }}
@endif
MVGL User Score
{{ (round(GameList::whereGameId($game->id)->avg('rating'), 1)) != 0 ? round(GameList::whereGameId($game->id)->avg('rating'), 1) : '-'}} {{ (GameList::whereGameId($game->id)->where('rating', '>=', 1)->count()) != 0 ? ' by ' . GameList::whereGameId($game->id)->where('rating', '>=', 1)->count() . ' user(s) ' : '' }}
MVGL Difficulty
{{ GameList::whereGameId($game->id)->avg('difficulty') ?? '-' }}
Composer(s)
{{ $game->composers ?? '-'}}
@if ($game->website)
Website
Official Website
@endif
Added by
{{ GameList::whereGameId($game->id)->count() ?? '0' }} User(s)

This game also exists on:
@foreach ($platforms as $platform) {{ $platform['name'] }} @endforeach