示例#1
0
 /**
  * Merge the "wheres" from a relation query to a has query.
  *
  * @param  \Illuminate\Database\Eloquent\Builder  $hasQuery
  * @param  \Illuminate\Database\Eloquent\Relations\Relation  $relation
  * @return void
  */
 protected function mergeModelDefinedRelationWheresToHasQuery(Builder $hasQuery, Relation $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->toBase();
     $hasQuery->withoutGlobalScopes()->mergeWheres($relationQuery->wheres, $relationQuery->getBindings());
 }