marcreichel / igdb-laravel

Simplify the integration of the IGDB API into your Laravel app. Including IGDB webhook support.
https://marcreichel.dev/docs/igdb-laravel
MIT License
104 stars 22 forks source link

Dot notation #31

Closed dherran closed 3 years ago

dherran commented 3 years ago

Is dot notation supported by this wrapper?

Say I want to search for something like this:

Game where the Twitch ID == 33214 (Fortnite) fields *; where external_games.category = 14 & external_games.uid = "33214";

Or this:

Games for PS4 fields *; where game.platforms = 48;

I have tried the below but always get NULL:

$igdb = new IGDB('games'); // 'games' is the endpoint
$games = $igdb->where('external_games.category', '14')->where('external_games.uid', 33214)->get();
///////
$games = $igdb->where('game.platforms', '48')->get();

Simpler queries do work, but as soon as I introduce dot notation the result is always null.

marcreichel commented 3 years ago

Hi @dherran,

thanks for your issue. I will look into this and get back to you 👍🏼

marcreichel commented 3 years ago

@dherran So. The problem was not the dot notation which works. The problem was with the builder. I've fixed this behavior with release 2.1.3 just now.

Just make sure your query looks like the following:

$igdb = new IGDB('games'); // 'games' is the endpoint
$games = $igdb->where('external_games.category', 14)->where('external_games.uid', '33214')->get();

So the external_games.category needs to be an integer and the external_games.uid needs to be a string. (This is required by IGDB).

marcreichel commented 3 years ago

Your second example just works by removing the leading game. because you are already in the game scope.

So the following works:

$igdb = new IGDB('games'); // 'games' is the endpoint
$games = $igdb->where('platforms', 48)->get();

Again: Make sure you provide an integer and not a string.

dherran commented 3 years ago

@marcreichel worked perfectly! thanks for the quick turnaround.