laravel withcount

Solutions on MaxInterview for laravel withcount by the best coders in the world

showing results for - "laravel withcount"
Buddy
01 Apr 2016
1$posts = App\Post::withCount('comments')->get();
2
3foreach ($posts as $post) {
4    echo $post->comments_count;
5}