Builder
Implements
Uses
Properties
$bindings array
The current query value bindings.
$aggregate array
An aggregate function and column to be run.
$columns array
The columns that should be returned.
$distinct bool|array
Indicates if the query returns distinct results.
Occasionally contains the columns that should be distinct.
$from string
The table which the query is targeting.
$joins array
The table joins for the query.
$wheres array
The where constraints for the query.
$groups array
The groupings for the query.
$havings array
The having constraints for the query.
$orders array
The orderings for the query.
$limit int
The maximum number of records to return.
$offset int
The number of records to skip.
$unions array
The query union statements.
$unionLimit int
The maximum number of union records to return.
$unionOffset int
The number of union records to skip.
$unionOrders array
The orderings for the union query.
$lock string|bool
Indicates whether row locking is being used.
$beforeQueryCallbacks array
The callbacks that should be invoked before the query is executed.
$operators string[]
All of the available clause operators.
$bitwiseOperators string[]
All of the available bitwise operators.
$useWritePdo bool
Whether to use write pdo for the select.
Methods
__construct ( ConnectionInterface $connection , Grammar $grammar , Processor $processor ) : void
Create a new query builder instance.
Parameters
- $connection ConnectionInterface
- $grammar Grammar |null
- $processor Processor |null
select ( $columns ) : $this
Set the columns to be selected.
Parameters
- $columns array|mixed
selectSub ( $query , $as ) : $this
Add a subselect expression to the query.
Parameters
selectRaw ( $expression , array $bindings ) : $this
Add a new "raw" select expression to the query.
Parameters
- $expression string
- $bindings array
fromSub ( $query , $as ) : $this
Makes "from" fetch from a subquery.
Parameters
fromRaw ( $expression , $bindings ) : $this
Add a raw from clause to the query.
Parameters
- $expression string
- $bindings mixed
createSub ( $query ) : array
Creates a subquery and parse it.
Parameters
parseSub ( $query ) : array
Parse the subquery into SQL and bindings.
Parameters
- $query mixed
prependDatabaseNameIfCrossDatabaseQuery ( $query ) : mixed
Prepend the database name if the given query is on another database.
Parameters
- $query mixed
addSelect ( $column ) : $this
Add a new select column to the query.
Parameters
- $column array|mixed
distinct ( ) : $this
Force the query to only return distinct results.
from ( $table , $as ) : $this
Set the table which the query is targeting.
Parameters
useIndex ( $index ) : $this
Add an index hint to suggest a query index.
Parameters
- $index string
forceIndex ( $index ) : $this
Add an index hint to force a query index.
Parameters
- $index string
ignoreIndex ( $index ) : $this
Add an index hint to ignore a query index.
Parameters
- $index string
join ( $table , $first , $operator , $second , $type , $where ) : $this
Add a join clause to the query.
Parameters
- $table Expression |string
- $first Closure |string
- $operator string|null
- $second string|null
- $type string
- $where bool
joinWhere ( $table , $first , $operator , $second , $type ) : $this
Add a "join where" clause to the query.
Parameters
- $table Expression |string
- $first Closure |string
- $operator string
- $second string
- $type string
joinSub ( $query , $as , $first , $operator , $second , $type , $where ) : $this
Add a subquery join clause to the query.
Parameters
leftJoin ( $table , $first , $operator , $second ) : $this
Add a left join to the query.
Parameters
- $table Expression |string
- $first Closure |string
- $operator string|null
- $second string|null
leftJoinWhere ( $table , $first , $operator , $second ) : $this
Add a "join where" clause to the query.
Parameters
- $table Expression |string
- $first Closure |string
- $operator string
- $second string
leftJoinSub ( $query , $as , $first , $operator , $second ) : $this
Add a subquery left join to the query.
Parameters
rightJoin ( $table , $first , $operator , $second ) : $this
Add a right join to the query.
Parameters
- $table Expression |string
- $first Closure |string
- $operator string|null
- $second string|null
rightJoinWhere ( $table , $first , $operator , $second ) : $this
Add a "right join where" clause to the query.
Parameters
- $table Expression |string
- $first Closure |string
- $operator string
- $second string
rightJoinSub ( $query , $as , $first , $operator , $second ) : $this
Add a subquery right join to the query.
Parameters
crossJoin ( $table , $first , $operator , $second ) : $this
Add a "cross join" clause to the query.
Parameters
- $table Expression |string
- $first Closure |string|null
- $operator string|null
- $second string|null
crossJoinSub ( $query , $as ) : $this
Add a subquery cross join to the query.
Parameters
newJoinClause ( $parentQuery , $type , $table ) : JoinClause
Get a new join clause.
Parameters
- $parentQuery Builder
- $type string
- $table string
mergeWheres ( $wheres , $bindings ) : $this
Merge an array of where clauses and bindings.
Parameters
- $wheres array
- $bindings array
where ( $column , $operator , $value , $boolean ) : $this
Add a basic where clause to the query.
Parameters
- $column Closure |string|array|Expression
- $operator mixed
- $value mixed
- $boolean string
addArrayOfWheres ( $column , $boolean , $method ) : $this
Add an array of where clauses to the query.
Parameters
- $column array
- $boolean string
- $method string
prepareValueAndOperator ( $value , $operator , $useDefault ) : array
Prepare the value and operator for a where clause.
Parameters
- $value string
- $operator string
- $useDefault bool
invalidOperatorAndValue ( $operator , $value ) : bool
Determine if the given operator and value combination is legal.
Parameters
- $operator string
- $value mixed
invalidOperator ( $operator ) : bool
Determine if the given operator is supported.
Parameters
- $operator string
isBitwiseOperator ( $operator ) : bool
Determine if the operator is a bitwise operator.
Parameters
- $operator string
orWhere ( $column , $operator , $value ) : $this
Add an "or where" clause to the query.
Parameters
- $column Closure |string|array|Expression
- $operator mixed
- $value mixed
whereNot ( $column , $operator , $value , $boolean ) : $this
Add a basic "where not" clause to the query.
Parameters
- $column Closure |string|array|Expression
- $operator mixed
- $value mixed
- $boolean string
orWhereNot ( $column , $operator , $value ) : $this
Add an "or where not" clause to the query.
Parameters
- $column Closure |string|array|Expression
- $operator mixed
- $value mixed
whereColumn ( $first , $operator , $second , $boolean ) : $this
Add a "where" clause comparing two columns to the query.
Parameters
- $first string|array
- $operator string|null
- $second string|null
- $boolean string|null
orWhereColumn ( $first , $operator , $second ) : $this
Add an "or where" clause comparing two columns to the query.
Parameters
- $first string|array
- $operator string|null
- $second string|null
whereRaw ( $sql , $bindings , $boolean ) : $this
Add a raw where clause to the query.
Parameters
- $sql string
- $bindings mixed
- $boolean string
orWhereRaw ( $sql , $bindings ) : $this
Add a raw or where clause to the query.
Parameters
- $sql string
- $bindings mixed
whereIn ( $column , $values , $boolean , $not ) : $this
Add a "where in" clause to the query.
Parameters
- $column Expression |string
- $values mixed
- $boolean string
- $not bool
orWhereIn ( $column , $values ) : $this
Add an "or where in" clause to the query.
Parameters
- $column Expression |string
- $values mixed
whereNotIn ( $column , $values , $boolean ) : $this
Add a "where not in" clause to the query.
Parameters
- $column Expression |string
- $values mixed
- $boolean string
orWhereNotIn ( $column , $values ) : $this
Add an "or where not in" clause to the query.
Parameters
- $column Expression |string
- $values mixed
whereIntegerInRaw ( $column , $values , $boolean , $not ) : $this
Add a "where in raw" clause for integer values to the query.
Parameters
- $column string
- $values Illuminate\...\Arrayable|array
- $boolean string
- $not bool
orWhereIntegerInRaw ( $column , $values ) : $this
Add an "or where in raw" clause for integer values to the query.
Parameters
- $column string
- $values Illuminate\...\Arrayable|array
whereIntegerNotInRaw ( $column , $values , $boolean ) : $this
Add a "where not in raw" clause for integer values to the query.
Parameters
- $column string
- $values Illuminate\...\Arrayable|array
- $boolean string
orWhereIntegerNotInRaw ( $column , $values ) : $this
Add an "or where not in raw" clause for integer values to the query.
Parameters
- $column string
- $values Illuminate\...\Arrayable|array
whereNull ( $columns , $boolean , $not ) : $this
Add a "where null" clause to the query.
Parameters
- $columns string|array|Expression
- $boolean string
- $not bool
orWhereNull ( $column ) : $this
Add an "or where null" clause to the query.
Parameters
- $column string|array|Expression
whereNotNull ( $columns , $boolean ) : $this
Add a "where not null" clause to the query.
Parameters
- $columns string|array|Expression
- $boolean string
whereBetween ( $column , iterable $values , $boolean , $not ) : $this
Add a where between statement to the query.
Parameters
- $column Expression |string
- $values iterable
- $boolean string
- $not bool
whereBetweenColumns ( $column , array $values , $boolean , $not ) : $this
Add a where between statement using columns to the query.
Parameters
- $column Expression |string
- $values array
- $boolean string
- $not bool
orWhereBetween ( $column , iterable $values ) : $this
Add an or where between statement to the query.
Parameters
- $column Expression |string
- $values iterable
orWhereBetweenColumns ( $column , array $values ) : $this
Add an or where between statement using columns to the query.
Parameters
- $column Expression |string
- $values array
whereNotBetween ( $column , iterable $values , $boolean ) : $this
Add a where not between statement to the query.
Parameters
- $column Expression |string
- $values iterable
- $boolean string
whereNotBetweenColumns ( $column , array $values , $boolean ) : $this
Add a where not between statement using columns to the query.
Parameters
- $column Expression |string
- $values array
- $boolean string
orWhereNotBetween ( $column , iterable $values ) : $this
Add an or where not between statement to the query.
Parameters
- $column Expression |string
- $values iterable
orWhereNotBetweenColumns ( $column , array $values ) : $this
Add an or where not between statement using columns to the query.
Parameters
- $column Expression |string
- $values array
orWhereNotNull ( $column ) : $this
Add an "or where not null" clause to the query.
Parameters
- $column Expression |string
whereDate ( $column , $operator , $value , $boolean ) : $this
Add a "where date" statement to the query.
Parameters
- $column Expression |string
- $operator string
- $value DateTimeInterface |string|null
- $boolean string
orWhereDate ( $column , $operator , $value ) : $this
Add an "or where date" statement to the query.
Parameters
- $column Expression |string
- $operator string
- $value DateTimeInterface |string|null
whereTime ( $column , $operator , $value , $boolean ) : $this
Add a "where time" statement to the query.
Parameters
- $column Expression |string
- $operator string
- $value DateTimeInterface |string|null
- $boolean string
orWhereTime ( $column , $operator , $value ) : $this
Add an "or where time" statement to the query.
Parameters
- $column Expression |string
- $operator string
- $value DateTimeInterface |string|null
whereDay ( $column , $operator , $value , $boolean ) : $this
Add a "where day" statement to the query.
Parameters
- $column Expression |string
- $operator string
- $value DateTimeInterface |string|int|null
- $boolean string
orWhereDay ( $column , $operator , $value ) : $this
Add an "or where day" statement to the query.
Parameters
- $column Expression |string
- $operator string
- $value DateTimeInterface |string|int|null
whereMonth ( $column , $operator , $value , $boolean ) : $this
Add a "where month" statement to the query.
Parameters
- $column Expression |string
- $operator string
- $value DateTimeInterface |string|int|null
- $boolean string
orWhereMonth ( $column , $operator , $value ) : $this
Add an "or where month" statement to the query.
Parameters
- $column Expression |string
- $operator string
- $value DateTimeInterface |string|int|null
whereYear ( $column , $operator , $value , $boolean ) : $this
Add a "where year" statement to the query.
Parameters
- $column Expression |string
- $operator string
- $value DateTimeInterface |string|int|null
- $boolean string
orWhereYear ( $column , $operator , $value ) : $this
Add an "or where year" statement to the query.
Parameters
- $column Expression |string
- $operator string
- $value DateTimeInterface |string|int|null
addDateBasedWhere ( $type , $column , $operator , $value , $boolean ) : $this
Add a date based (year, month, day, time) statement to the query.
Parameters
- $type string
- $column Expression |string
- $operator string
- $value mixed
- $boolean string
whereNested ( Closure $callback , $boolean ) : $this
Add a nested where statement to the query.
Parameters
- $callback Closure
- $boolean string
addNestedWhereQuery ( $query , $boolean ) : $this
Add another query builder as a nested where to the query builder.
Parameters
- $query Builder
- $boolean string
whereSub ( $column , $operator , Closure $callback , $boolean ) : $this
Add a full sub-select to the query.
Parameters
- $column Expression |string
- $operator string
- $callback Closure
- $boolean string
whereExists ( $callback , $boolean , $not ) : $this
Add an exists clause to the query.
Parameters
orWhereExists ( $callback , $not ) : $this
Add an or exists clause to the query.
Parameters
whereNotExists ( $callback , $boolean ) : $this
Add a where not exists clause to the query.
Parameters
orWhereNotExists ( $callback ) : $this
Add a where not exists clause to the query.
Parameters
addWhereExistsQuery ( $query , $boolean , $not ) : $this
Add an exists clause to the query.
Parameters
- $query Builder
- $boolean string
- $not bool
whereRowValues ( $columns , $operator , $values , $boolean ) : $this
Adds a where condition using row values.
Parameters
- $columns array
- $operator string
- $values array
- $boolean string
orWhereRowValues ( $columns , $operator , $values ) : $this
Adds an or where condition using row values.
Parameters
- $columns array
- $operator string
- $values array
whereJsonContains ( $column , $value , $boolean , $not ) : $this
Add a "where JSON contains" clause to the query.
Parameters
- $column string
- $value mixed
- $boolean string
- $not bool
orWhereJsonContains ( $column , $value ) : $this
Add an "or where JSON contains" clause to the query.
Parameters
- $column string
- $value mixed
whereJsonDoesntContain ( $column , $value , $boolean ) : $this
Add a "where JSON not contains" clause to the query.
Parameters
- $column string
- $value mixed
- $boolean string
orWhereJsonDoesntContain ( $column , $value ) : $this
Add an "or where JSON not contains" clause to the query.
Parameters
- $column string
- $value mixed
whereJsonContainsKey ( $column , $boolean , $not ) : $this
Add a clause that determines if a JSON path exists to the query.
Parameters
- $column string
- $boolean string
- $not bool
orWhereJsonContainsKey ( $column ) : $this
Add an "or" clause that determines if a JSON path exists to the query.
Parameters
- $column string
whereJsonDoesntContainKey ( $column , $boolean ) : $this
Add a clause that determines if a JSON path does not exist to the query.
Parameters
- $column string
- $boolean string
orWhereJsonDoesntContainKey ( $column ) : $this
Add an "or" clause that determines if a JSON path does not exist to the query.
Parameters
- $column string
whereJsonLength ( $column , $operator , $value , $boolean ) : $this
Add a "where JSON length" clause to the query.
Parameters
- $column string
- $operator mixed
- $value mixed
- $boolean string
orWhereJsonLength ( $column , $operator , $value ) : $this
Add an "or where JSON length" clause to the query.
Parameters
- $column string
- $operator mixed
- $value mixed
dynamicWhere ( $method , $parameters ) : $this
Handles dynamic "where" clauses to the query.
Parameters
- $method string
- $parameters array
addDynamic ( $segment , $connector , $parameters , $index ) : void
Add a single dynamic where clause statement to the query.
Parameters
- $segment string
- $connector string
- $parameters array
- $index int
whereFullText ( $columns , $value , array $options , $boolean ) : $this
Add a "where fulltext" clause to the query.
Parameters
- $columns string|string[]
- $value string
- $boolean string
orWhereFullText ( $columns , $value , array $options ) : $this
Add a "or where fulltext" clause to the query.
Parameters
- $columns string|string[]
- $value string
groupBy ( $groups ) : $this
Add a "group by" clause to the query.
Parameters
- $groups array|Expression |string
groupByRaw ( $sql , array $bindings ) : $this
Add a raw groupBy clause to the query.
Parameters
- $sql string
- $bindings array
having ( $column , $operator , $value , $boolean ) : $this
Add a "having" clause to the query.
Parameters
- $column Expression |Closure |string
- $operator string|int|float|null
- $value string|int|float|null
- $boolean string
orHaving ( $column , $operator , $value ) : $this
Add an "or having" clause to the query.
Parameters
- $column Expression |Closure |string
- $operator string|int|float|null
- $value string|int|float|null
havingNested ( Closure $callback , $boolean ) : $this
Add a nested having statement to the query.
Parameters
- $callback Closure
- $boolean string
addNestedHavingQuery ( $query , $boolean ) : $this
Add another query builder as a nested having to the query builder.
Parameters
- $query Builder
- $boolean string
havingNull ( $columns , $boolean , $not ) : $this
Add a "having null" clause to the query.
Parameters
- $columns string|array
- $boolean string
- $not bool
orHavingNull ( $column ) : $this
Add an "or having null" clause to the query.
Parameters
- $column string
havingNotNull ( $columns , $boolean ) : $this
Add a "having not null" clause to the query.
Parameters
- $columns string|array
- $boolean string
orHavingNotNull ( $column ) : $this
Add an "or having not null" clause to the query.
Parameters
- $column string
havingBetween ( $column , iterable $values , $boolean , $not ) : $this
Add a "having between " clause to the query.
Parameters
- $column string
- $values iterable
- $boolean string
- $not bool
havingRaw ( $sql , array $bindings , $boolean ) : $this
Add a raw having clause to the query.
Parameters
- $sql string
- $bindings array
- $boolean string
orHavingRaw ( $sql , array $bindings ) : $this
Add a raw or having clause to the query.
Parameters
- $sql string
- $bindings array
orderBy ( $column , $direction ) : $this
Add an "order by" clause to the query.
Parameters
- $column Closure |Builder |Builder |Expression |string
- $direction string
orderByDesc ( $column ) : $this
Add a descending "order by" clause to the query.
Parameters
- $column Closure |Builder |Builder |Expression |string
latest ( $column ) : $this
Add an "order by" clause for a timestamp to the query.
Parameters
- $column Closure |Builder |Expression |string
oldest ( $column ) : $this
Add an "order by" clause for a timestamp to the query.
Parameters
- $column Closure |Builder |Expression |string
inRandomOrder ( $seed ) : $this
Put the query's results in random order.
Parameters
- $seed string|int
orderByRaw ( $sql , $bindings ) : $this
Add a raw "order by" clause to the query.
Parameters
- $sql string
- $bindings array
skip ( $value ) : $this
Alias to set the "offset" value of the query.
Parameters
- $value int
offset ( $value ) : $this
Set the "offset" value of the query.
Parameters
- $value int
take ( $value ) : $this
Alias to set the "limit" value of the query.
Parameters
- $value int
limit ( $value ) : $this
Set the "limit" value of the query.
Parameters
- $value int
forPage ( $page , $perPage ) : $this
Set the limit and offset for a given page.
Parameters
- $page int
- $perPage int
forPageBeforeId ( $perPage , $lastId , $column ) : $this
Constrain the query to the previous "page" of results before a given ID.
Parameters
- $perPage int
- $lastId int|null
- $column string
forPageAfterId ( $perPage , $lastId , $column ) : $this
Constrain the query to the next "page" of results after a given ID.
Parameters
- $perPage int
- $lastId int|null
- $column string
reorder ( $column , $direction ) : $this
Remove all existing orders and optionally add a new order.
Parameters
- $column Closure |Builder |Expression |string|null
- $direction string
removeExistingOrdersFor ( $column ) : array
Get an array with all orders with a given column removed.
Parameters
- $column string
union ( $query , $all ) : $this
Add a union statement to the query.
Parameters
unionAll ( $query ) : $this
Add a union all statement to the query.
Parameters
lock ( $value ) : $this
Lock the selected rows in the table.
Parameters
- $value string|bool
lockForUpdate ( ) : $this
Lock the selected rows in the table for updating.
sharedLock ( ) : $this
Share lock the selected rows in the table.
beforeQuery ( callable $callback ) : $this
Register a closure to be invoked before the query is executed.
Parameters
- $callback callable
applyBeforeQueryCallbacks ( ) : void
Invoke the "before query" modification callbacks.
toSql ( ) : string
Get the SQL representation of the query.
toRawSql ( ) : string
Get the raw SQL representation of the query with embedded bindings.
find ( $id , $columns ) : mixed|static
Execute a query for a single record by ID.
Parameters
- $id int|string
- $columns array|string
findOr ( $id , $columns , Closure $callback ) : mixed|static
Execute a query for a single record by ID or call a callback.
Parameters
value ( $column ) : mixed
Get a single column's value from the first result of a query.
Parameters
- $column string
rawValue ( string $expression , array $bindings ) : mixed
Get a single expression value from the first result of a query.
Parameters
- $expression string
- $bindings array
soleValue ( $column ) : mixed
Get a single column's value from the first result of a query if it's the sole matching record.
Parameters
- $column string
get ( $columns ) : Illuminate\...\Collection
Execute the query as a "select" statement.
Parameters
- $columns array|string
runSelect ( ) : array
Run the query as a "select" statement against the connection.
paginate ( $perPage , $columns , $pageName , $page ) : LengthAwarePaginator
Paginate the given query into a simple paginator.
Parameters
simplePaginate ( $perPage , $columns , $pageName , $page ) : Paginator
Get a paginator only supporting simple next and previous links.
Parameters
- $perPage int
- $columns array|string
- $pageName string
- $page int|null
cursorPaginate ( $perPage , $columns , $cursorName , $cursor ) : CursorPaginator
Get a paginator only supporting simple next and previous links.
Parameters
- $perPage int|null
- $columns array|string
- $cursorName string
- $cursor Cursor |string|null
ensureOrderForCursorPagination ( $shouldReverse ) : Illuminate\...\Collection
Ensure the proper order by required for cursor pagination.
Parameters
- $shouldReverse bool
getCountForPagination ( $columns ) : int
Get the count of the total records for the paginator.
Parameters
- $columns array
runPaginationCountQuery ( $columns ) : array
Run a pagination count query.
Parameters
- $columns array
cloneForPaginationCount ( ) : self
Clone the existing query instance for usage in a pagination subquery.
withoutSelectAliases ( array $columns ) : array
Remove the column aliases since they will break count queries.
Parameters
- $columns array
cursor ( ) : Illuminate\...\LazyCollection
Get a lazy collection for the given query.
enforceOrderBy ( ) : void
Throw an exception if the query doesn't have an orderBy clause.
pluck ( $column , $key ) : Illuminate\...\Collection
Get a collection instance containing the values of a given column.
Parameters
- $column Expression |string
- $key string|null
stripTableForPluck ( $column ) : string|null
Strip off the table name or alias from a column identifier.
Parameters
- $column string
pluckFromObjectColumn ( $queryResult , $column , $key ) : Illuminate\...\Collection
Retrieve column values from rows represented as objects.
Parameters
- $queryResult array
- $column string
- $key string
pluckFromArrayColumn ( $queryResult , $column , $key ) : Illuminate\...\Collection
Retrieve column values from rows represented as arrays.
Parameters
- $queryResult array
- $column string
- $key string
implode ( $column , $glue ) : string
Concatenate values of a given column as a string.
Parameters
- $column string
- $glue string
exists ( ) : bool
Determine if any rows exist for the current query.
doesntExist ( ) : bool
Determine if no rows exist for the current query.
existsOr ( Closure $callback ) : mixed
Execute the given callback if no rows exist for the current query.
Parameters
- $callback Closure
doesntExistOr ( Closure $callback ) : mixed
Execute the given callback if rows exist for the current query.
Parameters
- $callback Closure
count ( $columns ) : int
Retrieve the "count" result of the query.
Parameters
- $columns Expression |string
min ( $column ) : mixed
Retrieve the minimum value of a given column.
Parameters
- $column Expression |string
max ( $column ) : mixed
Retrieve the maximum value of a given column.
Parameters
- $column Expression |string
sum ( $column ) : mixed
Retrieve the sum of the values of a given column.
Parameters
- $column Expression |string
avg ( $column ) : mixed
Retrieve the average of the values of a given column.
Parameters
- $column Expression |string
average ( $column ) : mixed
Alias for the "avg" method.
Parameters
- $column Expression |string
aggregate ( $function , $columns ) : mixed
Execute an aggregate function on the database.
Parameters
- $function string
- $columns array
numericAggregate ( $function , $columns ) : float|int
Execute a numeric aggregate function on the database.
Parameters
- $function string
- $columns array
setAggregate ( $function , $columns ) : $this
Set the aggregate property without running the query.
Parameters
- $function string
- $columns array
onceWithColumns ( $columns , $callback ) : mixed
Execute the given callback while selecting the given columns.
Parameters
- $columns array
- $callback callable
insert ( array $values ) : bool
Insert new records into the database.
Parameters
- $values array
insertOrIgnore ( array $values ) : int
Insert new records into the database while ignoring errors.
Parameters
- $values array
insertGetId ( array $values , $sequence ) : int
Insert a new record and get the value of the primary key.
Parameters
- $values array
- $sequence string|null
insertUsing ( array $columns , $query ) : int
Insert new records into the table using a subquery.
Parameters
update ( array $values ) : int
Update records in the database.
Parameters
- $values array
updateFrom ( array $values ) : int
Update records in a PostgreSQL database using the update from syntax.
Parameters
- $values array
updateOrInsert ( array $attributes , array $values ) : bool
Insert or update a record matching the attributes, and fill it with values.
Parameters
- $attributes array
- $values array
upsert ( array $values , $uniqueBy , $update ) : int
Insert new records or update the existing ones.
Parameters
- $values array
- $uniqueBy array|string
- $update array|null
increment ( $column , $amount , array $extra ) : int
Increment a column's value by a given amount.
Parameters
- $column string
- $amount float|int
- $extra array
incrementEach ( array $columns , array $extra ) : int
Increment the given column's values by the given amounts.
Parameters
-
$columns
array
|int|numeric-string> -
$extra
array
decrement ( $column , $amount , array $extra ) : int
Decrement a column's value by a given amount.
Parameters
- $column string
- $amount float|int
- $extra array
decrementEach ( array $columns , array $extra ) : int
Decrement the given column's values by the given amounts.
Parameters
-
$columns
array
|int|numeric-string> -
$extra
array
delete ( $id ) : int
Delete records from the database.
Parameters
- $id mixed
truncate ( ) : void
Run a truncate statement on the table.
getColumns ( ) : array
Get all of the query builder's columns in a text-only array with all expressions evaluated.
getBindings ( ) : array
Get the current query value bindings in a flattened array.
getRawBindings ( ) : array
Get the raw array of bindings.
setBindings ( array $bindings , $type ) : $this
Set the bindings on the query builder.
Parameters
- $bindings array
- $type string
addBinding ( $value , $type ) : $this
Add a binding to the query.
Parameters
- $value mixed
- $type string
castBinding ( $value ) : mixed
Cast the given binding value.
Parameters
- $value mixed
mergeBindings ( $query ) : $this
Merge an array of bindings into our bindings.
Parameters
- $query Builder
cleanBindings ( array $bindings ) : array
Remove all of the expressions from a list of bindings.
Parameters
- $bindings array
flattenValue ( $value ) : mixed
Get a scalar type value from an unknown type of input.
Parameters
- $value mixed
defaultKeyName ( ) : string
Get the default key name of the table.
useWritePdo ( ) : $this
Use the "write" PDO connection when executing the query.
isQueryable ( $value ) : bool
Determine if the value is a query builder instance or a Closure.
Parameters
- $value mixed
clone ( ) : static
Clone the query.
cloneWithout ( array $properties ) : static
Clone the query without the given properties.
Parameters
- $properties array
cloneWithoutBindings ( array $except ) : static
Clone the query without the given bindings.
Parameters
- $except array
dump ( ) : $this
Dump the current SQL and bindings.
dumpRawSql ( ) : $this
Dump the raw current SQL with embedded bindings.
dd ( ) : never
Die and dump the current SQL and bindings.
ddRawSql ( ) : never
Die and dump the current SQL with embedded bindings.
__call ( $method , $parameters ) : mixed
Handle dynamic method calls into the method.
Parameters
- $method string
- $parameters array