Even though there are multiple questions like this I can\'t get my query to return the row with the most recent date with a group by.
I have the following table..
You might also want to orderBy message_id as well
orderBy
message_id
$messages = Message::where('to', Auth::id()) ->groupBy('from') ->orderBy('created_at', 'DESC') ->orderBy('message_id', 'DESC') ->paginate(10);