Laravel - Relationships - Relationship Counting And Custom Select Statements

If you're combining withCount with a select statement, ensure that you call withCount after the select method:

    
    $posts = Post::select(['title', 'body'])
                    ->withCount('comments')
                    ->get();