i have following query thread , messages:
$thread = thread::with('messages.user.zone') ->with('participants.user') ->findorfail($id);
.
i want thread messages
ordered it's created_at
property desc
.
currently order oldest new (asc)
how can that? tried ->orderby('messages.created_at')
no luck
this should work:
->with(['messages' => function($q) { $q->orderby('created_at', 'desc'); }, 'messages.user.zone'])
Comments
Post a Comment