/** * Remove the scope from the given Analogue query builder. * * @param \Analogue\ORM\System\Query $query * @return void */ public function remove(Query $query) { $column = $query->getMapper()->getEntityMap()->getQualifiedDeletedAtColumn(); $query = $query->getQuery(); foreach ((array) $query->wheres as $key => $where) { // If the where clause is a soft delete date constraint, we will remove it from // the query and reset the keys on the wheres. This allows this developer to // include deleted model in a relationship result set that is lazy loaded. if ($this->isSoftDeleteConstraint($where, $column)) { unset($query->wheres[$key]); $query->wheres = array_values($query->wheres); } } }