/** * Merge the "wheres" from a relation query to a has query. * * @param \Analogue\ORM\System\Query $hasQuery * @param \Analogue\ORM\Relationships\Relationship $relation * @return void */ protected function mergeWheresToHas(Query $hasQuery, Relationship $relation) { // Here we have the "has" query and the original relation. We need to copy over any // where clauses the developer may have put in the relationship function over to // the has query, and then copy the bindings from the "has" query to the main. $relationQuery = $relation->getBaseQuery(); $hasQuery->mergeWheres($relationQuery->wheres, $relationQuery->getBindings()); $this->query->mergeBindings($hasQuery->getQuery()); }