id, consoleId: $game->console_id, title: $game->title, slug: $game->slug, igdbId: $game->igdb_id, tgdbId: $game->tgdb_id, description: $game->description, releaseYear: $game->release_year, developer: $game->developer, publisher: $game->publisher, genre: $game->genre, rating: $game->rating ? (float) $game->rating : null, coverPath: $game->cover_path, thumbnailPath: $game->thumbnail_path, console: $game->relationLoaded('console') && $game->console ? ConsoleData::fromModel($game->console) : null, romFiles: $game->relationLoaded('romFiles') ? $game->romFiles->map(fn ($rom) => RomFileData::fromModel($rom))->toArray() : null, ); } }