build: initialize RetroHub with Laravel, Inertia, Vue, and Horizon

This commit is contained in:
2026-08-10 13:45:18 +02:00
commit 717db65139
218 changed files with 28356 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
use App\Features\Consoles\Console;
use App\Features\Games\Game;
use Illuminate\Support\Facades\Route;
Route::middleware('auth:sanctum')->group(function () {
Route::get('/consoles', function () {
return response()->json(Console::withCount('games')->orderBy('name')->get());
});
Route::get('/games', function () {
$query = Game::with('console');
if (request()->has('console')) {
$query->whereHas('console', function ($q) {
$q->where('slug', request()->console);
});
}
if (request()->has('search')) {
$query->where('title', 'like', '%'.request()->search.'%');
}
return response()->json($query->orderBy('title')->paginate(24));
});
Route::get('/games/{game}', function (Game $game) {
$game->load(['console', 'romFiles']);
return response()->json($game);
});
});