@extends('layouts.app') @php use Illuminate\Support\Str; @endphp @section('title', $game->title . ' — LoreKeepers') @section('description', $game->summary ? Str::limit($game->summary, 155) : 'Track ' . $game->title . ' on LoreKeepers.') @section('og_title', $game->title . ' — LoreKeepers') @section('og_description', $game->summary ? Str::limit($game->summary, 155) : 'Track ' . $game->title . ' on LoreKeepers.') @section('og_image', $game->cover_url ?? asset('images/og-default.jpg')) @section('og_type', 'game') @section('content')
{{-- Main Info --}}
{{-- Cover --}}
@if($game->cover_url) {{ $game->title }} @else
@endif
{{-- Details --}}
{{-- Title & Year --}}
@if($game->release_year) {{ $game->release_year }} @endif

{{ $game->title }}

{{-- Rating --}}
@if($game->rating_avg)
{{ number_format($game->rating_avg, 1) }} / 10
{{ number_format($game->rating_count) }} {{ Str::plural('rating', $game->rating_count) }} @else No ratings yet @endif
{{-- Genres & Platforms --}} @if($game->genres->isNotEmpty())
@foreach($game->genres as $genre) {{ $genre->name }} @endforeach
@endif @if($game->platforms->isNotEmpty())
@foreach($game->platforms as $platform) {{ $platform->name }} @endforeach
@endif {{-- Add to Library --}}
@if($userGame) {{-- Already in library --}}
@foreach(['playing' => 'Playing', 'played' => 'Played', 'want_to_play' => 'Want to Play', 'on_hold' => 'On Hold', 'dropped' => 'Dropped'] as $s => $label) @endforeach
{{-- Rating --}}
Your rating: / 10
@else @auth
{{-- Step 1: pick a status --}}
@foreach(['playing' => 'Playing', 'played' => 'Played', 'want_to_play' => 'Want to Play', 'on_hold' => 'On Hold', 'dropped' => 'Dropped'] as $s => $label) @endforeach
{{-- Step 2: optional rating + save --}}
Adding as
/10
@else Log in to Add to Library @endauth @endif {{-- Toast notification --}}
{{-- Add to List --}} @auth
@else
@endauth {{-- Companies --}} @if($game->companies->isNotEmpty())
@php $developers = $game->companies->where('pivot.role', 'developer'); $publishers = $game->companies->where('pivot.role', 'publisher'); @endphp @if($developers->isNotEmpty())
Developer: {{ $developers->pluck('name')->join(', ') }}
@endif @if($publishers->isNotEmpty())
Publisher: {{ $publishers->pluck('name')->join(', ') }}
@endif
@endif
{{-- Summary --}} @if($game->summary)

Summary

{{ $game->summary }}

@endif {{-- Screenshots --}} @if($game->screenshots->isNotEmpty())

Screenshots

@foreach($game->screenshots as $i => $shot) @endforeach
{{-- Lightbox overlay --}}
@endif {{-- Comments --}} @php $commentsData = $comments->map(fn($c) => [ 'id' => $c->id, 'body' => $c->body, 'user' => ['name' => $c->user->name, 'slug' => $c->user->slug], 'user_id' => $c->user_id, 'created_at' => $c->created_at->diffForHumans(), 'replies' => $c->replies->map(fn($r) => [ 'id' => $r->id, 'body' => $r->body, 'user' => ['name' => $r->user->name, 'slug' => $r->user->slug], 'user_id' => $r->user_id, 'created_at' => $r->created_at->diffForHumans(), ])->values()->all(), ])->values()->all(); @endphp

Discussion

{{-- New comment form (auth only) --}} @auth
@else

Log in to join the discussion.

@endauth {{-- Comment list --}}
{{-- Reviews --}}

Reviews

{{-- Review List --}}
@forelse($game->reviews->take(10) as $review)
{{ strtoupper(substr($review->user->name, 0, 1)) }}
{{ $review->user->slug ?? $review->user->name }} @if($review->has_spoilers) Spoilers @endif
@if($review->rating)
{{ $review->rating }} /10
@endif @auth @if(auth()->id() === $review->user_id) @endif @endauth

{{ $review->body }}

@empty

No reviews yet. Be the first!

@endforelse
{{-- Write / Edit Review Form --}} @auth

/10

You've already reviewed this game.

@else

Log in to write a review.

@endauth
@push('scripts') @endpush @endsection