Illuminate\Database\Eloquent\Builder::addHasWhere PHP Method

addHasWhere() protected method

Add the "has" condition where clause to the query.
protected addHasWhere ( Builder $hasQuery, Illuminate\Database\Eloquent\Relations\Relation $relation, string $operator, integer $count, string $boolean ) : Builder | static
$hasQuery Builder
$relation Illuminate\Database\Eloquent\Relations\Relation
$operator string
$count integer
$boolean string
return Builder | static
    protected function addHasWhere(Builder $hasQuery, Relation $relation, $operator, $count, $boolean)
    {
        $hasQuery->mergeModelDefinedRelationConstraints($relation->getQuery());
        if ($this->shouldRunExistsQuery($operator, $count)) {
            $not = $operator === '<' && $count === 1;
            return $this->addWhereExistsQuery($hasQuery->toBase(), $boolean, $not);
        }
        return $this->whereCountQuery($hasQuery->toBase(), $operator, $count, $boolean);
    }