Closed eduardonwa closed 3 years ago
You should not loop on comments but on posts and then display the number of comments for that post, not the other way around:
foreach($posts as $post)
$post->title etc.
$post->comments->count()
That should do it.
Thank you
I been trying to do this for days, how do I count comments without repeating the count for the other posts?
I have 3 posts but when I apply that in my view I get the count for just 1 of the posts, then the number gets repeated for other posts. I checked this https://github.com/laravelista/comments/issues/149, and that could work as well only problem is still returning the same count for all of my posts.