/** * @param \Notadd\Foundation\Database\Eloquent\Builder $hasQuery * @param \Notadd\Foundation\Database\Eloquent\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->addBinding($hasQuery->getQuery()->getBindings(), 'where'); }