Get a new query builder that only includes soft deletes.

@return \Nova\Database\ORM\Builder|static
480106
public static function onlyTrashed()
    {
        $instance = new static;

        $column = $instance->getQualifiedDeletedAtColumn();

        return $instance->newQueryWithoutScope(new SoftDeletingScope)->whereNotNull($column);
    }
370370
public static function query($options = array())
	{
		$query = Query_Soft::forge(get_called_class(), static::connection(), $options);

		if (static::get_filter_status())
		{
			//Make sure we are filtering out soft deleted items
			$query->set_soft_filter(static::soft_delete_property('deleted_field', static::$_default_field_name));
		}

		return $query;
	}
1231224
public function createQuery()
    {
        $query = new Query($this->objectType);
        if ($this->defaultOrderings) {
            $query->setOrderings($this->defaultOrderings);
        }
        return $query;
    }
791107
public function findAllOpenQuery(): AbstractQuery
    {
        $qb = $this->createQueryBuilder('p');

        return $qb
            // Add conditions.
            ->andWhere($qb->expr()->eq('p.active', ':active'))
            ->andWhere($qb->expr()->orX(
                $qb->expr()->isNull('p.expiry'),
                $qb->expr()->gt('p.expiry', ':now')
            ))

            // Add parameters.
            ->setParameter('active', true)
            ->setParameter('now', new \DateTime())

            // Order by and get results.
            ->orderBy('p.name', 'ASC')
            ->getQuery();
    }
341642
public function createQuery()
    {
        $query = $this->persistenceManager->createQueryForType($this->entityClassName);
        if ($this->defaultOrderings !== []) {
            $query->setOrderings($this->defaultOrderings);
        }
        return $query;
    }
503220
public function query() : Builder
	{
		if (! is_null($this->min) && ! is_null($this->max)) {
			$this->builder->whereBetween('price', [$this->min, $this->max]);
		}

		if (! is_null($this->min) && is_null($this->max)) {
			$this->builder->where('price', '>=', $this->min);
		}

		if (is_null($this->min) && ! is_null($this->max)) {
			$this->builder->where('price', '<=', $this->max);
		}

		return $this->builder;
	}
615138
function delete()
    {

        if (!$this->exists()) {
            return false;
        }

        $this->newQuery()->id($this->getID())->delete();

        $this->exists = false;

        return $this;
    }
59769
public function getModelsToDelete()
    {
        return $this->models->filter(function (AbstractModel $model) {
            return ($model->isDeleted() and ! $model->isSoftDeleted());
        });
    }
352072
protected function query()
	{
		$query = forward_static_call(
			[
				$this->getModelClass(),
				'query',
			]
		);

		$this->modifyQuery($query);

		$eager_loads = $this->getEagerLoads();

		if ( !empty($eager_loads)) {
			$this->safeWith($query, $eager_loads);
		}

		if ( !empty($modifiers = $this->getModifiers())) {
			foreach ($modifiers as $modifier) {
				$modifier($query);
			}
		}

		return $query;
	}
1006998
public function onlyTrashed()
	{
		$this->withTrashed();

		$this->query->whereNotNull($this->model->getQualifiedDeletedAtColumn());

		return $this;
	}
152960
public function newQueryWithoutScopes()
    {
        $builder = $this->newQueryBuilder(
            $this->newBaseQueryBuilder()
        );

        return $builder->setModel($this)->with($this->with);
    }
196266
protected function buildDelete()
	{
		//initialize $where and $limit container vars to empty strings
		$where = $limit = '';

		//define the string formating template
		$template = "DELETE FROM %s %s %s";

		//get the where clause variable
		$queryWhere = $this->wheres;

		//check if where clause is empty
		if ( ! empty($queryWhere) ) 
		{
			//convert where clause array to string
			$joined = join(" AND ", $queryWhere);

			//compose the where string
			$where = "WHERE {$joined}";

		}

		//get the limit clause variable
		$queryLimit = $this->limits;

		//check if limit clause is empty
		if ( ! empty($queryLimit) ) 
		{
			//get the offset value
			$limitOffset = $this->offset;

			//compose the limit clause string
			$limit = "LIMIT {$queryLimit} {$limitOffset}";

		}

		//return the formated query string
		return sprintf($template, $this->froms, $where, $limit);

	}
626087
protected function newQuery()
    {
        $query = $this->model->newQuery();

        foreach ($this->withRelationships as $relationship) {
            $query->with($relationship);
        }

        return $query;
    }
799818
protected function newBaseQueryBuilder()
    {
        $conn = $this->getConnection();

        $grammar = $conn->getQueryGrammar();

        $builder = new Builder($conn, $grammar, $conn->getPostProcessor());
        $builder->cacheDriver($this->cache);

        if ($this->expire !== null) {
            $builder->remember($this->expire);
        }

        $builder->cacheTags($this->table);

        return $builder;
    }
720870
public function getQuery(): Query
    {
        if ($this->table === null) {
            throw new Exception('Unable to build DELETE query when table name is not set');
        }

        $sql = "DELETE FROM {$this->table}";

        if ($this->hasWhere()) {
            $sql .= "\nWHERE{$this->getWhereSql()}";
        }

        return new Query($sql, $this->getBindings(), $this->getAdapterConnection());
    }
712252
public function newQuery($excludeDeleted = true)
	{
		$builder = $this->newActiveRecordBuilder($this->newBaseQueryBuilder());

		// Once we have the query builders, we will set the model instances so the
		// builder can easily access any information it may need from the model
		// while it is constructing and executing various queries against it.
		$builder->setModel($this)->with($this->with);

		if ($excludeDeleted && $this->softDelete)
		{
			$builder->whereNull($this->getQualifiedDeletedAtColumn());
		}

		return $builder;
	}
333176
public function cloneQueryBuilder()
    {
        $paramContent = $this->newParamName();
        
        $subQuery = clone $this->queryBuilder;
        $subQuery->resetDQLParts();
        $subQuery->setParameters([]);
        $subQuery->select($paramContent)->from('OpiferCmsBundle:Content', $paramContent);

        return $subQuery;
    }