How to get latest data with groupBy in Laravel 8
I want to make a chat app. So I can get a list of patient but the top last message doesn't have the patient. How to solve my problem. PHP : $appointment = Appointment::with([ 'upcoming.consultant' => function($query) use ($user) {…