public function countWhereHas($relation, array $where = [], array $whereHas = [])
    {
        $query = $this->make();

        $query = $this->applyWhere($query, $where);

        $query = $query->whereHas($relation, function ($q) use ($whereHas) {
            $this->applyWhere($q, $whereHas);
        });

        return $query->count();
    }
public function countWhereHas($relation, array $where = [], array $whereHas = [])
    {
        $query = $this->make();

        $query = $this->applyWhere($query, $where);

        $query = $query->whereHas($relation, function ($q) use ($whereHas) {
            $this->applyWhere($q, $whereHas);
        });

        return $query->count();
    }
public function countWhereHas ( $ relation , array $ where = [ ] , array $ whereHas = [ ] ) { $ query = $ this -> make ( ) ; $ query = $ this -> applyWhere ( $ query , $ where ) ; $ query = $ query -> whereHas ( $ relation , function ( $ q ) use ( $ whereHas ) { $ this -> applyWhere ( $ q , $ whereHas ) ; } ) ; return $ query -> count ( ) ; }
Count all records that have a required relationship and matching input parameters..

@param string $relation
@param array $where
@param array $whereHas

@return int
Count all records that have a required relationship and matching input parameters ..