Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

germanraffo's avatar

Get the latest reviewed games

¡Hi, folks! ¿How are you?

I'm having some trouble trying to figure out how to get the latest reviewed games.

I'll give you a bit of context. I have two tables:

  1. Games
  2. Reviews

So:

Reviews belongs to Game and Game has many Reviews

I think that the logic of the query must be something like: Obtain the last review of each game and obtain its created_at date.

Then, use the date of the last review of each game to order the games.

But i can't transform that logic into a query :(

0 likes
5 replies
germanraffo's avatar

Im running Laravel 5.8.* and thats answer fits to 6^. I will try to upgrade to that version, but i will appreciate a solution for 5.8.*.

Thanks a lot buddy!

sunilbfcj's avatar

$user = DB::table('users')->latest()->first();

Please or to participate in this conversation.