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 may replace groupBy with distinct, as it works in my case.
$messages = Message::where('to', Auth::id()) ->orderBy('created_at', 'DESC') ->distinct('from') ->paginate(10);
Hope this helps.