I perform the following query with no problem. But it doesn't get the results I want.
I want 3 comments for each post, but I think it gets 3 comments totally. How can I resolve this?
$posts = Post::with([
'comments' => function($c) {
$c->orderBy('commentTimestamp', 'desc')->take(3)->get();
}
])
->take(10)
->get();
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire