withBody( "fields *,age_ratings.*, age_ratings.*, name, cover.url, first_release_date, total_rating_count, platforms.abbreviation, rating, rating_count, slug, involved_companies.company.name, genres.name, aggregated_rating, summary, websites.*, videos.*, screenshots.*, similar_games.*, similar_games.cover.url, similar_games.platforms.abbreviation; where slug=\"{$slug}\";", "text/plain" )->post('https://api.igdb.com/v4/games') ->json(); abort_if(!$game, 404); #dd($game); return $game[0]; } public static function getPreparedGameDetails(string $slug) { $game = IGDBController::getGameDetails($slug); $rating_ids = []; foreach ($game['age_ratings'] as $rating){ array_push($rating_ids, $rating['rating']); } $game['age_ratings'] = $rating_ids; abort_if(!$game, 404); #dd($game); return $game; } public static function searchGameByName(string $name) { $response = Http::withHeaders(config('services.igdb')) ->withBody( "search \"{$name}\"; fields *, name, cover.url, first_release_date, total_rating_count, platforms.abbreviation, rating, rating_count, slug, involved_companies.company.name, genres.name, aggregated_rating, summary, websites.*, videos.*, screenshots.*, similar_games.*, similar_games.cover.url, similar_games.platforms.abbreviation;", "text/plain" ) ->post('https://api.igdb.com/v4/games') ->json(); return $response; } public static function searchGameBySlug(string $slug) { $game_list = Http::withHeaders(config('services.igdb'))->withBody( "fields *, name, cover.url, first_release_date, total_rating_count, platforms.abbreviation, rating, rating_count, slug, involved_companies.company.name, genres.name, aggregated_rating, summary, websites.*, videos.*, screenshots.*, similar_games.*, similar_games.cover.url, similar_games.platforms.abbreviation; where slug=\"{$slug}\";", "text/plain" )->post('https://api.igdb.com/v4/games') ->json(); abort_if(!$game, 404); #dd($game); return $game[0]; } public static function getAgeRatingData() { /* *Note* Nullable (einige Felder sind nicht bei allen Einträgen gesetzt) field type description category Category Enum The organization that has issued a specific rating checksum uuid Hash of the object content_descriptions Array of Age Rating Content Description IDs rating Rating Enum The title of an age rating rating_cover_url String The url for the image of a age rating synopsis String A free text motivating a rating */ $game_list = Http::withHeaders(config('services.igdb'))->withBody( "fields *, content_descriptions.* , rating_cover_url ;", "text/plain" )->post('https://api.igdb.com/v4/age_ratings') ->json(); abort_if(!$game, 404); #dd($game); return $game[0]; } }