If you're combining withCount with a select statement, ensure that you call withCount after the select method:
withCount
select
$posts = Post::select(['title', 'body']) ->withCount('comments') ->get();