@Ozan I suppose you got all you need already, so I will just add one important thing about eager loading: You don't execute the query within the eager loading closure. The reason is, that from this closure only query builder is returned and eloquent doesn't know that you already fetched the result.
I use returned above because in fact it is not returned, even if you return any value it will be ignored. Eloquent simply adds constraints from the closure and executes the query later.
And count is one of methods that execute the query.
The only way to use that query and its result is to assign it to the variable passed by reference - something that I mentioned in this forum, like this:
Model::with(['relation' => function ($q) use (&$result) {
$result = $q->get() / count() / whatever..
}])->find(..) / get();