Add friend library comparison and game comments features

- CompareController: side-by-side library diff with stats (common games, rating diff)
- GameCommentController + GameCommentPolicy: threaded comments with replies, auth-gated
- GameComment model with top-level scope and self-referential replies relation
- Migration: game_comments table with parent_id for threading
- games/show: Discussion section with Alpine.js (post, reply, delete)
- compare/show: tabbed view (in common, they have, you have) with game cards
- users/show: "Compare Libraries" button visible to other authenticated users

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mark
2026-05-30 12:04:24 +03:00
co-authored by Claude Sonnet 4.6
parent 3083071a6c
commit 14047dfe37
12 changed files with 608 additions and 2 deletions
+13
View File
@@ -1,5 +1,7 @@
<?php
use App\Http\Controllers\CompareController;
use App\Http\Controllers\GameCommentController;
use App\Http\Controllers\GameController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\LibraryController;
@@ -21,6 +23,11 @@ Route::get('/games/{game:slug}', [GameController::class, 'show'])->name('games.s
Route::get('/users/{user:username}', [UserController::class, 'show'])->name('users.show');
Route::get('/users/{user:username}/library', [UserController::class, 'library'])->name('users.library');
// Compare (auth required)
Route::middleware('auth')->group(function () {
Route::get('/users/{user:username}/compare', [CompareController::class, 'show'])->name('users.compare');
});
// Library (auth required)
Route::middleware('auth')->group(function () {
Route::post('/library', [LibraryController::class, 'store'])->name('library.store');
@@ -35,6 +42,12 @@ Route::middleware('auth')->group(function () {
Route::delete('/reviews/{review}', [\App\Http\Controllers\ReviewController::class, 'destroy'])->name('reviews.destroy');
});
// Comments (auth required)
Route::middleware('auth')->group(function () {
Route::post('/games/{game:slug}/comments', [GameCommentController::class, 'store'])->name('games.comments.store');
Route::delete('/comments/{comment}', [GameCommentController::class, 'destroy'])->name('comments.destroy');
});
// Lists
Route::get('/lists', [\App\Http\Controllers\ListController::class, 'index'])->name('lists.index')->middleware('auth');
Route::post('/lists', [\App\Http\Controllers\ListController::class, 'store'])->name('lists.store')->middleware('auth');