Retrive relation on a polymorphic model
You didn't specify which version of Laravel is used, so I am going to presume it is 5.x. If that is incorrect, please notify me and update your post with such relevant information

I am not sure exactly how to reduce the queries for comments but the suggestion below should allow remove the loop of queries for the user on each game.

Eager Loading

(Nested) Eager Loading - utilizing the with() method - can be used to populate the user property for each item in the collection:

$games = Game::join('comments', 'games.id', '=', 'comments.commentable_id')
-&gt;where('comments.commentable_type', Game::class)
-&gt;latest('comments.created_at')
-&gt;groupBy('games.id')
-&gt;take(10)
-&gt;with('comment.user')
-&gt;withCount('comments')


Variable naming

The lambda/closure passed to each() accepts a parameter named $games. Isn't it actually a representation of a game? If so, $game would be more appropriate. Additionally, other developers reading the code may be confused because $games is also used for the assignment of the collection.