I've never used it but you're receiving that error because the looped $platform is clearly still an object, so echoing it out won't work.
To get a better idea of the API, you can do a dd($platform) to see what properties and methods are available.
EDIT: https://igdb.github.io/api/endpoints/platform/
Read that, this is what is returned when you hit that endpoint. As you can see you get an array of game IDs.
So now you'll need to hit another endpoint for retrieving a game using the ID's you have received back.
By the look of it tho, you can only search for one game at a time. I imagine there will be hundreds of PS4 games, and that's quite an expensive and timely thing to do by sending a request for each game.
You might want to reconsider how you approach this. You could retrieve all games and them store them in a database or cache them, that way you dont hit their API every single time.