user(); $stats = new DashboardStatsData( totalGames: $this->gameRepository->count(), totalConsoles: Console::count(), totalRoms: $this->romFileRepository->count(), userSaves: $user->saveFiles()->count(), ); $recentGames = $this->gameRepository->getRecent(10) ->map(fn ($game) => GameData::fromModel($game)); $consoles = Console::withCount('games')->get() ->map(fn ($console) => ConsoleData::fromModel($console)); return Inertia::render('Dashboard/Index', [ 'stats' => $stats, 'recentGames' => $recentGames, 'consoles' => $consoles, ]); } }