protected function getCount(Relation $relation)
    {
        if ( ! $relation) return 0;

        $query = $this->modifyRelationQueryForContext($relation->getRelated(), $relation->getQuery());

        return $query->count();
    }
protected function getCount(Relation $relation)
    {
        if ( ! $relation) return 0;

        $query = $this->modifyRelationQueryForContext($relation->getRelated(), $relation->getQuery());

        return $query->count();
    }
protected function getCount ( Relation $ relation ) { if ( ! $ relation ) return 0 ; $ query = $ this -> modifyRelationQueryForContext ( $ relation -> getRelated ( ) , $ relation -> getQuery ( ) ) ; return $ query -> count ( ) ; }
Returns the count for a given relation.

@param Relation $relation
@return int
Returns the count for a given relation .