Hm... Try this:
$posts = Post::where('category_id', $category->id)
->join('comments', function($c) {
$c->on('comments.post_id','=','posts.id')
->orderBy('commentTimestamp')
->take(6)
})
->take(20)
->get();
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community