Method |
Description |
|
__call ( string $method, array $parameters ) : mixed |
Dynamically handle calls into the query instance. |
|
__clone ( ) : void |
Force a clone of the underlying query builder when cloning. |
|
__construct ( Builder $query ) : void |
Create a new Eloquent query builder instance. |
|
applyScopes ( ) : Builder | static |
Apply the scopes to the Eloquent builder instance and return it. |
|
chunk ( integer $count, callable $callback ) : boolean |
Chunk the results of the query. |
|
chunkById ( integer $count, callable $callback, string $column = 'id' ) : boolean |
Chunk the results of a query by comparing numeric IDs. |
|
cursor ( ) : Generator |
Get a generator for the given query. |
|
decrement ( string $column, integer $amount = 1, array $extra = [] ) : integer |
Decrement a column's value by a given amount. |
|
delete ( ) : mixed |
Delete a record from the database. |
|
doesntHave ( string $relation, string $boolean = 'and', Closure $callback = null ) : Builder | static |
Add a relationship count / exists condition to the query. |
|
each ( callable $callback, integer $count = 1000 ) : boolean |
Execute a callback over each item while chunking. |
|
eagerLoadRelations ( array $models ) : array |
Eager load the relationships for the models. |
|
find ( mixed $id, array $columns = ['*'] ) : Model | Illuminate\Database\Eloquent\Collection | static[] | static | null |
Find a model by its primary key. |
|
findMany ( array $ids, array $columns = ['*'] ) : Illuminate\Database\Eloquent\Collection |
Find multiple models by their primary keys. |
|
findOrFail ( mixed $id, array $columns = ['*'] ) : Model | Illuminate\Database\Eloquent\Collection |
Find a model by its primary key or throw an exception. |
|
findOrNew ( mixed $id, array $columns = ['*'] ) : Model |
Find a model by its primary key or return fresh model instance. |
|
first ( array $columns = ['*'] ) : Model | static | null |
Execute the query and get the first result. |
|
firstOr ( Closure | array $columns = ['*'], Closure $callback = null ) : Model | static | mixed |
Execute the query and get the first result or call a callback. |
|
firstOrCreate ( array $attributes, array $values = [] ) : Model |
Get the first record matching the attributes or create it. |
|
firstOrFail ( array $columns = ['*'] ) : Model | static |
Execute the query and get the first result or throw an exception. |
|
firstOrNew ( array $attributes, array $values = [] ) : Model |
Get the first record matching the attributes or instantiate it. |
|
forceDelete ( ) : mixed |
Run the default delete function on the builder. |
|
get ( array $columns = ['*'] ) : Illuminate\Database\Eloquent\Collection | static[] |
Execute the query as a "select" statement. |
|
getEagerLoads ( ) : array |
Get the relationships being eagerly loaded. |
|
getMacro ( string $name ) : Closure |
Get the given macro by name. |
|
getModel ( ) : Model |
Get the model instance being queried. |
|
getModels ( array $columns = ['*'] ) : Model[] |
Get the hydrated models without eager loading. |
|
getQuery ( ) : Builder |
Get the underlying query builder instance. |
|
getRelation ( string $name ) : Illuminate\Database\Eloquent\Relations\Relation |
Get the relation instance for the given relation name. |
|
has ( string $relation, string $operator = '>=', integer $count = 1, string $boolean = 'and', Closure $callback = null ) : Builder | static |
Add a relationship count / exists condition to the query. |
|
increment ( string $column, integer $amount = 1, array $extra = [] ) : integer |
Increment a column's value by a given amount. |
|
macro ( string $name, Closure $callback ) : void |
Extend the builder with a given callback. |
|
mergeModelDefinedRelationConstraints ( Builder $relation ) : Builder | static |
Merge the constraints from a relation query to the current query. |
|
onDelete ( Closure $callback ) : void |
Register a replacement for the default delete function. |
|
orHas ( string $relation, string $operator = '>=', integer $count = 1 ) : Builder | static |
Add a relationship count / exists condition to the query with an "or". |
|
orWhere ( string | Closure $column, string $operator = null, mixed $value = null ) : Builder | static |
Add an "or where" clause to the query. |
|
orWhereHas ( string $relation, Closure $callback, string $operator = '>=', integer $count = 1 ) : Builder | static |
Add a relationship count / exists condition to the query with where clauses and an "or". |
|
paginate ( integer $perPage = null, array $columns = ['*'], string $pageName = 'page', integer | null $page = null ) : Illuminate\Contracts\Pagination\LengthAwarePaginator |
Paginate the given query. |
|
pluck ( string $column, string | null $key = null ) : Collection |
Get an array with the values of a given column. |
|
removedScopes ( ) : array |
Get an array of global scopes that were removed from the query. |
|
scopes ( array $scopes ) : mixed |
Add the given scopes to the current builder instance. |
|
setEagerLoads ( array $eagerLoad ) |
Set the relationships being eagerly loaded. |
|
setModel ( Model $model ) |
Set a model instance for the model being queried. |
|
setQuery ( Builder $query ) |
Set the underlying query builder instance. |
|
simplePaginate ( integer $perPage = null, array $columns = ['*'], string $pageName = 'page', integer | null $page = null ) : Illuminate\Contracts\Pagination\Paginator |
Paginate the given query into a simple paginator. |
|
toBase ( ) : Builder |
Get a base query builder instance. |
|
update ( array $values ) : integer |
Update a record in the database. |
|
updateOrCreate ( array $attributes, array $values = [] ) : Model |
Create or update a record matching the attributes, and fill it with values. |
|
value ( string $column ) : mixed |
Get a single column's value from the first result of a query. |
|
when ( boolean $value, Closure $callback, Closure $default = null ) |
Apply the callback's query changes if the given "value" is true. |
|
where ( string | Closure $column, string $operator = null, mixed $value = null, string $boolean = 'and' ) |
Add a basic where clause to the query. |
|
whereDoesntHave ( string $relation, Closure $callback = null ) : Builder | static |
Add a relationship count / exists condition to the query with where clauses. |
|
whereHas ( string $relation, Closure $callback = null, string $operator = '>=', integer $count = 1 ) : Builder | static |
Add a relationship count / exists condition to the query with where clauses. |
|
whereKey ( mixed $id ) |
Add a where clause on the primary key to the query. |
|
with ( mixed $relations ) |
Set the relationships that should be eager loaded. |
|
withCount ( mixed $relations ) |
Add subselect queries to count the relations. |
|
withGlobalScope ( string $identifier, Illuminate\Database\Eloquent\Scope | Closure $scope ) |
Register a new global scope. |
|
without ( mixed $relations ) |
Prevent the specified relations from being eager loaded. |
|
withoutGlobalScope ( Illuminate\Database\Eloquent\Scope | string $scope ) |
Remove a registered global scope. |
|
withoutGlobalScopes ( array $scopes = null ) |
Remove all or passed registered global scopes. |
|