October\Rain\Database\Builder

Source: ~/vendor/october/rain/src/Database/Builder.php

Extends:

  • Illuminate\Database\Eloquent\Builder

Query builder class.

Extends Eloquent builder class.

Protected properties

There are no protected properties in the class.

Show inherited protected properties

Inherited protected properties

  • protected Illuminate\Database\Query\Builder $query - defined in Illuminate\Database\Eloquent\Builder. The base query builder instance.
  • protected Illuminate\Database\Eloquent\Model $model - defined in Illuminate\Database\Eloquent\Builder. The model being queried.
  • protected array $eagerLoad - defined in Illuminate\Database\Eloquent\Builder. The relationships that should be eager loaded.
  • protected static array $macros - defined in Illuminate\Database\Eloquent\Builder. All of the globally registered builder macros.
  • protected array $localMacros - defined in Illuminate\Database\Eloquent\Builder. All of the locally registered builder macros.
  • protected Closure $onDelete - defined in Illuminate\Database\Eloquent\Builder. A replacement for the typical delete function.
  • protected array $passthru - defined in Illuminate\Database\Eloquent\Builder. The methods that should be returned from query builder.
  • protected array $scopes - defined in Illuminate\Database\Eloquent\Builder. Applied global scopes.
  • protected array $removedScopes - defined in Illuminate\Database\Eloquent\Builder. Removed global scopes.

Public methods

public mixed __call(string $method, array $parameters)

Dynamically handle calls into the query instance.

Parameters
  • string $method
  • array $parameters

public Illuminate\Support\Collection lists(string $column, string|null $key=NULL)

Get an array with the values of a given column.

Parameters
  • string $column
  • string|null $key

public self orSearchWhere(string $term, array $columns=array(), string $mode='all')

Add an "or search where" clause to the query.

Parameters
  • string $term - Search query
  • array $columns - Table columns to search
  • string $mode - Search mode: all, any, exact.

public Illuminate\Contracts\Pagination\LengthAwarePaginator paginate(int $perPage=15, int $currentPage=NULL, array $columns=array( 0=>'*'), string $pageName='page')

Paginate the given query.

Parameters
  • int $perPage
  • int $currentPage
  • array $columns
  • string $pageName

public self searchWhere(string $term, array $columns=array(), string $mode='all')

Perform a search on this query for term found in columns.

Parameters
  • string $term - Search query
  • array $columns - Table columns to search
  • string $mode - Search mode: all, any, exact.

public Illuminate\Contracts\Pagination\Paginator simplePaginate(int $perPage=NULL, int $currentPage=NULL, array $columns='page', $columns=array( 0=>'*'))

Paginate the given query into a simple paginator.

Parameters
  • int $perPage
  • int $currentPage
  • array $columns
  • $columns

Show inherited public methods

Inherited public methods

  • public static mixed __callStatic(string $method, array $parameters) - defined in Illuminate\Database\Eloquent\Builder. Dynamically handle calls into the query instance.
  • public void __clone() - defined in Illuminate\Database\Eloquent\Builder. Force a clone of the underlying query builder when cloning.
  • public void __construct(Illuminate\Database\Query\Builder $query) - defined in Illuminate\Database\Eloquent\Builder. Create a new Eloquent query builder instance.
  • public Illuminate\Database\Eloquent\Builder|static applyScopes() - defined in Illuminate\Database\Eloquent\Builder. Apply the scopes to the Eloquent builder instance and return it.
  • public bool chunk(int $count, callable $callback) - defined in Illuminate\Database\Eloquent\Builder. Chunk the results of the query.
  • public bool chunkById(int $count, callable $callback, string $column=NULL, string|null $alias=NULL) - defined in Illuminate\Database\Eloquent\Builder. Chunk the results of a query by comparing numeric IDs.
  • public Illuminate\Database\Eloquent\Model|$this create(array $attributes=array()) - defined in Illuminate\Database\Eloquent\Builder. Save a new model and return the instance.
  • public Generator cursor() - defined in Illuminate\Database\Eloquent\Builder. Get a generator for the given query.
  • public int decrement(string $column, int $amount=1, array $extra=array()) - defined in Illuminate\Database\Eloquent\Builder. Decrement a column's value by a given amount.
  • public mixed delete() - defined in Illuminate\Database\Eloquent\Builder. Delete a record from the database.
  • public Illuminate\Database\Eloquent\Builder|static doesntHave(string $relation, string $boolean='and', Closure|null $callback=NULL) - defined in Illuminate\Database\Eloquent\Builder. Add a relationship count / exists condition to the query.
  • public bool each(callable $callback, int $count=1000) - defined in Illuminate\Database\Eloquent\Builder. Execute a callback over each item while chunking.
  • public array eagerLoadRelations(array $models) - defined in Illuminate\Database\Eloquent\Builder. Eager load the relationships for the models.
  • public [[Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static[]|static|null]] find(mixed $id, array $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Builder. Find a model by its primary key.
  • public Illuminate\Database\Eloquent\Collection findMany(Illuminate\Contracts\Support\Arrayable|array $ids, array $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Builder. Find multiple models by their primary keys.
  • public Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection findOrFail(mixed $id, array $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Builder. Find a model by its primary key or throw an exception.
  • public Illuminate\Database\Eloquent\Model findOrNew(mixed $id, array $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Builder. Find a model by its primary key or return fresh model instance.
  • public Illuminate\Database\Eloquent\Model|static|null first(array $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Builder. Execute the query and get the first result.
  • public Illuminate\Database\Eloquent\Model|static|mixed firstOr(Closure|array $columns=array( 0=>'*'), Closure|null $callback=NULL) - defined in Illuminate\Database\Eloquent\Builder. Execute the query and get the first result or call a callback.
  • public Illuminate\Database\Eloquent\Model firstOrCreate(array $attributes, array $values=array()) - defined in Illuminate\Database\Eloquent\Builder. Get the first record matching the attributes or create it.
  • public Illuminate\Database\Eloquent\Model|static firstOrFail(array $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Builder. Execute the query and get the first result or throw an exception.
  • public Illuminate\Database\Eloquent\Model firstOrNew(array $attributes, array $values=array()) - defined in Illuminate\Database\Eloquent\Builder. Get the first record matching the attributes or instantiate it.
  • public Illuminate\Database\Eloquent\Model|$this forceCreate(array $attributes) - defined in Illuminate\Database\Eloquent\Builder. Save a new model and return the instance. Allow mass-assignment.
  • public mixed forceDelete() - defined in Illuminate\Database\Eloquent\Builder. Run the default delete function on the builder.
  • public Illuminate\Database\Eloquent\Collection fromQuery(string $query, array $bindings=array()) - defined in Illuminate\Database\Eloquent\Builder. Create a collection of models from a raw query.
  • public Illuminate\Database\Eloquent\Collection|static[] get(array $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Builder. Execute the query as a "select" statement.
  • public array getEagerLoads() - defined in Illuminate\Database\Eloquent\Builder. Get the relationships being eagerly loaded.
  • public Closure getMacro(string $name) - defined in Illuminate\Database\Eloquent\Builder. Get the given macro by name.
  • public Illuminate\Database\Eloquent\Model getModel() - defined in Illuminate\Database\Eloquent\Builder. Get the model instance being queried.
  • public Illuminate\Database\Eloquent\Model[] getModels(array $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Builder. Get the hydrated models without eager loading.
  • public Illuminate\Database\Query\Builder getQuery() - defined in Illuminate\Database\Eloquent\Builder. Get the underlying query builder instance.
  • public Illuminate\Database\Eloquent\Relations\Relation getRelation(string $name) - defined in Illuminate\Database\Eloquent\Builder. Get the relation instance for the given relation name.
  • public Illuminate\Database\Eloquent\Builder|static has(string $relation, string $operator='>=', int $count=1, string $boolean='and', Closure|null $callback=NULL) - defined in Illuminate\Database\Eloquent\Builder. Add a relationship count / exists condition to the query.
  • public Illuminate\Database\Eloquent\Collection hydrate(array $items) - defined in Illuminate\Database\Eloquent\Builder. Create a collection of models from plain arrays.
  • public int increment(string $column, int $amount=1, array $extra=array()) - defined in Illuminate\Database\Eloquent\Builder. Increment a column's value by a given amount.
  • public Illuminate\Database\Eloquent\Model make(array $attributes=array()) - defined in Illuminate\Database\Eloquent\Builder. Create and return an un-saved model instance.
  • public Illuminate\Database\Eloquent\Builder|static mergeConstraintsFrom(Illuminate\Database\Eloquent\Builder $from) - defined in Illuminate\Database\Eloquent\Builder. Merge the where constraints from another query to the current query.
  • public Illuminate\Database\Eloquent\Model newModelInstance(array $attributes=array()) - defined in Illuminate\Database\Eloquent\Builder. Create a new instance of the model being queried.
  • public void onDelete(Closure $callback) - defined in Illuminate\Database\Eloquent\Builder. Register a replacement for the default delete function.
  • public Illuminate\Database\Eloquent\Builder|static orDoesntHave(string $relation) - defined in Illuminate\Database\Eloquent\Builder. Add a relationship count / exists condition to the query with an "or".
  • public Illuminate\Database\Eloquent\Builder|static orHas(string $relation, string $operator='>=', int $count=1) - defined in Illuminate\Database\Eloquent\Builder. Add a relationship count / exists condition to the query with an "or".
  • public Illuminate\Database\Eloquent\Builder|static orWhere(Closure|array|string $column, string $operator=NULL, mixed $value=NULL) - defined in Illuminate\Database\Eloquent\Builder. Add an "or where" clause to the query.
  • public Illuminate\Database\Eloquent\Builder|static orWhereDoesntHave(string $relation, Closure $callback=NULL) - defined in Illuminate\Database\Eloquent\Builder. Add a relationship count / exists condition to the query with where clauses and an "or".
  • public Illuminate\Database\Eloquent\Builder|static orWhereHas(string $relation, Closure $callback=NULL, string $operator='>=', int $count=1) - defined in Illuminate\Database\Eloquent\Builder. Add a relationship count / exists condition to the query with where clauses and an "or".
  • public Illuminate\Support\Collection pluck(string $column, string|null $key=NULL) - defined in Illuminate\Database\Eloquent\Builder. Get an array with the values of a given column.
  • public array removedScopes() - defined in Illuminate\Database\Eloquent\Builder. Get an array of global scopes that were removed from the query.
  • public mixed scopes(array $scopes) - defined in Illuminate\Database\Eloquent\Builder. Call the given local model scopes.
  • public $this setEagerLoads(array $eagerLoad) - defined in Illuminate\Database\Eloquent\Builder. Set the relationships being eagerly loaded.
  • public $this setModel(Illuminate\Database\Eloquent\Model $model) - defined in Illuminate\Database\Eloquent\Builder. Set a model instance for the model being queried.
  • public $this setQuery(Illuminate\Database\Query\Builder $query) - defined in Illuminate\Database\Eloquent\Builder. Set the underlying query builder instance.
  • public Illuminate\Database\Query\Builder tap(Closure $callback) - defined in Illuminate\Database\Eloquent\Builder. Pass the query to a given callback.
  • public Illuminate\Database\Query\Builder toBase() - defined in Illuminate\Database\Eloquent\Builder. Get a base query builder instance.
  • public mixed unless(mixed $value, callable $callback, callable $default=NULL) - defined in Illuminate\Database\Eloquent\Builder. Apply the callback's query changes if the given "value" is false.
  • public int update(array $values) - defined in Illuminate\Database\Eloquent\Builder. Update a record in the database.
  • public Illuminate\Database\Eloquent\Model updateOrCreate(array $attributes, array $values=array()) - defined in Illuminate\Database\Eloquent\Builder. Create or update a record matching the attributes, and fill it with values.
  • public mixed value(string $column) - defined in Illuminate\Database\Eloquent\Builder. Get a single column's value from the first result of a query.
  • public mixed when(mixed $value, callable $callback, callable $default=NULL) - defined in Illuminate\Database\Eloquent\Builder. Apply the callback's query changes if the given "value" is true.
  • public $this where(string|array|\Closure $column, string $operator=NULL, mixed $value=NULL, string $boolean='and') - defined in Illuminate\Database\Eloquent\Builder. Add a basic where clause to the query.
  • public Illuminate\Database\Eloquent\Builder|static whereDoesntHave(string $relation, Closure|null $callback=NULL) - defined in Illuminate\Database\Eloquent\Builder. Add a relationship count / exists condition to the query with where clauses.
  • public Illuminate\Database\Eloquent\Builder|static whereHas(string $relation, Closure|null $callback=NULL, string $operator='>=', int $count=1) - defined in Illuminate\Database\Eloquent\Builder. Add a relationship count / exists condition to the query with where clauses.
  • public $this whereKey(mixed $id) - defined in Illuminate\Database\Eloquent\Builder. Add a where clause on the primary key to the query.
  • public $this whereKeyNot(mixed $id) - defined in Illuminate\Database\Eloquent\Builder. Add a where clause on the primary key to the query.
  • public $this with(mixed $relations) - defined in Illuminate\Database\Eloquent\Builder. Set the relationships that should be eager loaded.
  • public $this withCount(mixed $relations) - defined in Illuminate\Database\Eloquent\Builder. Add subselect queries to count the relations.
  • public $this withGlobalScope(string $identifier, Illuminate\Database\Eloquent\Scope|\Closure $scope) - defined in Illuminate\Database\Eloquent\Builder. Register a new global scope.
  • public $this without(mixed $relations) - defined in Illuminate\Database\Eloquent\Builder. Prevent the specified relations from being eager loaded.
  • public $this withoutGlobalScope(Illuminate\Database\Eloquent\Scope|string $scope) - defined in Illuminate\Database\Eloquent\Builder. Remove a registered global scope.
  • public $this withoutGlobalScopes(array|null $scopes=NULL) - defined in Illuminate\Database\Eloquent\Builder. Remove all or passed registered global scopes.

Protected methods

protected void searchWhereInternal($term, $columns, $mode, $boolean)

Internal method to apply a search constraint to the query. Mode can be any of these options:

  • all: result must contain all words
  • any: result can contain any word
  • exact: result must contain the exact phrase
Parameters
  • $term
  • $columns
  • $mode
  • $boolean

Show inherited protected methods

Inherited protected methods

  • protected Illuminate\Database\Eloquent\Builder|static addHasWhere(Illuminate\Database\Eloquent\Builder $hasQuery, Illuminate\Database\Eloquent\Relations\Relation $relation, string $operator, int $count, string $boolean) - defined in Illuminate\Database\Eloquent\Builder. Add the "has" condition where clause to the query.
  • protected array addNestedWiths(string $name, array $results) - defined in Illuminate\Database\Eloquent\Builder. Parse the nested relationships in a relation.
  • protected void addNewWheresWithinGroup(Illuminate\Database\Query\Builder $query, int $originalWhereCount) - defined in Illuminate\Database\Eloquent\Builder. Nest where conditions by slicing them at the given where count.
  • protected array addUpdatedAtColumn(array $values) - defined in Illuminate\Database\Eloquent\Builder. Add the "updated at" column to an array of values.
  • protected $this addWhereCountQuery(Illuminate\Database\Query\Builder $query, string $operator='>=', int $count=1, string $boolean='and') - defined in Illuminate\Database\Eloquent\Builder. Add a sub-query count clause to this query.
  • protected mixed callScope(callable $scope, array $parameters=array()) - defined in Illuminate\Database\Eloquent\Builder. Apply the given scope on the current builder instance.
  • protected bool canUseExistsForExistenceCheck(string $operator, int $count) - defined in Illuminate\Database\Eloquent\Builder. Check if we can run an "exists" query to optimize performance.
  • protected array createNestedWhere(array $whereSlice, string $boolean='and') - defined in Illuminate\Database\Eloquent\Builder. Create a where array with nested where conditions.
  • protected array createSelectWithConstraint(string $name) - defined in Illuminate\Database\Eloquent\Builder. Create a constraint to select the given columns for the relation.
  • protected array eagerLoadRelation(array $models, string $name, Closure $constraints) - defined in Illuminate\Database\Eloquent\Builder. Eagerly load the relationship on a set of models.
  • protected void enforceOrderBy() - defined in Illuminate\Database\Eloquent\Builder. Add a generic "order by" clause if the query doesn't already have one.
  • protected Illuminate\Database\Eloquent\Relations\Relation getRelationWithoutConstraints(string $relation) - defined in Illuminate\Database\Eloquent\Builder. Get the "has relation" base query instance.
  • protected void groupWhereSliceForScope(Illuminate\Database\Query\Builder $query, array $whereSlice) - defined in Illuminate\Database\Eloquent\Builder. Slice where conditions at the given offset and add them to the query as a nested condition.
  • protected Illuminate\Database\Eloquent\Builder|static hasNested(string $relations, string $operator='>=', int $count=1, string $boolean='and', Closure|null $callback=NULL) - defined in Illuminate\Database\Eloquent\Builder. Add nested relationship count / exists conditions to the query.
  • protected bool isNestedUnder(string $relation, string $name) - defined in Illuminate\Database\Eloquent\Builder. Determine if the relationship is nested.
  • protected Illuminate\Pagination\LengthAwarePaginator paginator(Illuminate\Support\Collection $items, int $total, int $perPage, int $currentPage, array $options) - defined in Illuminate\Database\Eloquent\Builder. Create a new length-aware paginator instance.
  • protected array parseWithRelations(array $relations) - defined in Illuminate\Database\Eloquent\Builder. Parse a list of relations into individuals.
  • protected array relationsNestedUnder(string $relation) - defined in Illuminate\Database\Eloquent\Builder. Get the deeply nested relations for a given top-level relation.
  • protected Illuminate\Pagination\Paginator simplePaginator(Illuminate\Support\Collection $items, int $perPage, int $currentPage, array $options) - defined in Illuminate\Database\Eloquent\Builder. Create a new simple paginator instance.