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

Help with platform filter #23

Closed jadersbr closed 3 years ago

jadersbr commented 3 years ago

Hello,

I did not found an example for my needs.

I would like to get a total games of Playstation 2 and a list of games.

1) I tryed get total with this code, but platform is a relation and did not work:

$platforms_games_total = Game::where('platforms', '28')->count();

I'm receiving Null as return.

2) I tryed get a list of playstation 2 games, but this also did not work:

$games = Game::where('platforms', '28')->get();

Could you help me?

Best regards.

scottcharlesworth commented 3 years ago

@jadersilvabr the count() method is broken. I've done a pull request to fix it (#24).

The ID for "Playstation 2" is 8, not 28 (which doesn't exist).

The following returns results:

$games = Game::where('platforms', 8)->get();
jadersbr commented 3 years ago

Hi @scottcharlesworth

Sorry for my confusion with ID.

I did some tests now and all is working fine.

Ps: The count() method working fine after fix #24.

Best regards.