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();
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2UpLRyt
via IFTTT
Aucun commentaire:
Enregistrer un commentaire