To use a `where` clause on a `withCount` method, you simply chain the `where` method to the `withCount` method. The `where` method takes two parameters – the column name and the value to filter by. Here is an example: $posts = Post::withCount(['comments' => function ($query) { $query->where.