/** * Merge the "wheres" from a relation query to a has query. * * @param \Database\ORM\Builder $hasQuery * @param \Database\ORM\Relations\Relation $relation * @return void */ protected function mergeWheresToHas(Builder $hasQuery, Relation $relation) { $relationQuery = $relation->getBaseQuery(); $hasQuery = $hasQuery->getModel()->removeGlobalScopes($hasQuery); $hasQuery->mergeWheres($relationQuery->wheres, $relationQuery->getBindings()); $this->query->mergeBindings($hasQuery->getQuery()); }