PHP Class Eloquent, someline-starter

User: qixieyu Date: 15-7-3 Time: 下午8:41
Inheritance: extends Db
ファイルを表示 Open project: someline/someline-starter Class Usage Examples

Public Methods

Method Description
addBinding ( mixed $value, string $type = 'where' ) Add a binding to the query.
addNestedWhereQuery ( Builder | static $query, string $boolean = 'and' ) Add another query builder as a nested where to the query builder.
addSelect ( array | mixed $column ) Add a new select column to the query.
addWhereExistsQuery ( Builder $query, string $boolean = 'and', boolean $not = false ) Add an exists clause to the query.
aggregate ( string $function, array $columns = [] ) : float | integer Execute an aggregate function on the database.
applyScopes ( ) : Builder | static Apply the scopes to the Eloquent builder instance and return it.
average ( string $column ) : float | integer Alias for the "avg" method.
avg ( string $column ) : float | integer Retrieve the average of the values of a given column.
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.
count ( string $columns = '*' ) : integer Retrieve the "count" result of the query.
crossJoin ( string $table, string $first = null, string $operator = null, string $second = null ) : Builder | static Add a "cross join" clause to the query.
cursor ( ) : Generator Get a generator for the given query.
distinct ( ) Force the query to only return distinct results.
doesntHave ( string $relation, string $boolean = 'and', Closure | null $callback = null ) : Builder | static Add a relationship count / exists condition to the query.
dynamicWhere ( string $method, string $parameters ) Handles dynamic "where" clauses 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.
exists ( ) : boolean Determine if any rows exist for the current query.
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.
firstOrCreate ( array $attributes ) : 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 ) : Model Get the first record matching the attributes or instantiate it.
forNestedWhere ( ) : Builder Create a new query instance for nested where condition.
forPage ( integer $page, integer $perPage = 15 ) : Builder | static Set the limit and offset for a given page.
forPageAfterId ( integer $perPage = 15, integer $lastId, string $column = 'id' ) : Builder | static Constrain the query to the next "page" of results after a given ID.
from ( string $table ) Set the table which the query is targeting.
get ( array $columns = [] ) : Illuminate\Database\Eloquent\Collection | static[] Execute the query as a "select" statement.
getBindings ( ) : array Get the current query value bindings in a flattened array.
getCountForPagination ( array $columns = [] ) : integer Get the count of the total records for the paginator.
getEagerLoads ( ) : array Get the relationships being eagerly loaded.
getGrammar ( ) : Illuminate\Database\Query\Grammars\Grammar Get the query grammar instance.
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.
getProcessor ( ) : Illuminate\Database\Query\Processors\Processor Get the database query processor instance.
getQuery ( ) : Builder Get the underlying query builder instance.
getRawBindings ( ) : array Get the raw array of bindings.
groupBy ( ) Add a "group by" clause to the query.
has ( string $relation, string $operator = '>=', integer $count = 1, string $boolean = 'and', Closure | null $callback = null ) : Builder | static Add a relationship count / exists condition to the query.
hasMacro ( string $name ) : boolean Checks if macro is registered.
having ( string $column, string $operator = null, string $value = null, string $boolean = 'and' ) Add a "having" clause to the query.
havingRaw ( string $sql, array $bindings = [], string $boolean = 'and' ) Add a raw having clause to the query.
implode ( string $column, string $glue = '' ) : string Concatenate values of a given column as a string.
inRandomOrder ( string $seed = '' ) Put the query's results in random order.
insert ( array $values ) : boolean Insert a new record into the database.
insertGetId ( array $values, string $sequence = null ) : integer Insert a new record and get the value of the primary key.
join ( string $table, string $one, string $operator = null, string $two = null, string $type = 'inner', boolean $where = false ) Add a join clause to the query.
joinWhere ( string $table, string $one, string $operator, string $two, string $type = 'inner' ) : Builder | static Add a "join where" clause to the query.
latest ( string $column = 'created_at' ) : Builder | static Add an "order by" clause for a timestamp to the query.
leftJoin ( string $table, string $first, string $operator = null, string $second = null ) : Builder | static Add a left join to the query.
leftJoinWhere ( string $table, string $one, string $operator, string $two ) : Builder | static Add a "join where" clause to the query.
limit ( integer $value ) Set the "limit" value of the query.
lists ( string $column, string $key = null ) : Collection Alias for the "pluck" method.
lock ( boolean $value = true ) Lock the selected rows in the table.
lockForUpdate ( ) : Builder Lock the selected rows in the table for updating.
macro ( string $name, Closure $callback ) : void Extend the builder with a given callback.
macroCall ( string $method, array $parameters ) : mixed Dynamically handle calls to the class.
max ( string $column ) : float | integer Retrieve the maximum value of a given column.
mergeBindings ( Builder $query ) Merge an array of bindings into our bindings.
mergeModelDefinedRelationConstraints ( Builder $relation ) : Builder | static Merge the constraints from a relation query to the current query.
mergeWheres ( array $wheres, array $bindings ) : void Merge an array of where clauses and bindings.
min ( string $column ) : float | integer Retrieve the minimum value of a given column.
offset ( integer $value ) Set the "offset" value of the query.
oldest ( string $column = 'created_at' ) : Builder | static Add an "order by" clause for a timestamp to the 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".
orHaving ( string $column, string $operator = null, string $value = null ) : Builder | static Add a "or having" clause to the query.
orHavingRaw ( string $sql, array $bindings = [] ) : Builder | static Add a raw or having clause to the query.
orWhere ( string $column, string $operator = null, mixed $value = null ) : Builder | static Add an "or where" clause to the query.
orWhereBetween ( string $column, array $values ) : Builder | static Add an or where between statement to the query.
orWhereColumn ( string | array $first, string | null $operator = null, string | null $second = null ) : Builder | static Add an "or where" clause comparing two columns to the query.
orWhereDate ( string $column, string $operator, integer $value ) : Builder | static Add an "or where date" statement to the query.
orWhereExists ( Closure $callback, boolean $not = false ) : Builder | static Add an or exists 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".
orWhereIn ( string $column, mixed $values ) : Builder | static Add an "or where in" clause to the query.
orWhereNotBetween ( string $column, array $values ) : Builder | static Add an or where not between statement to the query.
orWhereNotExists ( Closure $callback ) : Builder | static Add a where not exists clause to the query.
orWhereNotIn ( string $column, mixed $values ) : Builder | static Add an "or where not in" clause to the query.
orWhereNotNull ( string $column ) : Builder | static Add an "or where not null" clause to the query.
orWhereNull ( string $column ) : Builder | static Add an "or where null" clause to the query.
orWhereRaw ( string $sql, array $bindings = [] ) : Builder | static Add a raw or where clause to the query.
orWhereTime ( string $column, string $operator, integer $value ) : Builder | static Add an "or where time" statement to the query.
orderBy ( string $column, string $direction = 'asc' ) Add an "order by" clause to the query.
orderByRaw ( string $sql, array $bindings = [] ) Add a raw "order by" clause to the query.
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.
raw ( mixed $value ) : Illuminate\Database\Query\Expression Create a raw database expression.
removedScopes ( ) : array Get an array of global scopes that were removed from the query.
rightJoin ( string $table, string $first, string $operator = null, string $second = null ) : Builder | static Add a right join to the query.
rightJoinWhere ( string $table, string $one, string $operator, string $two ) : Builder | static Add a "right join where" clause to the query.
scopes ( array $scopes ) : mixed Add the given scopes to the current builder instance.
select ( array | mixed $columns = [] ) Set the columns to be selected.
selectRaw ( string $expression, array $bindings = [] ) : Builder | static Add a new "raw" select expression to the query.
selectSub ( Closure | Builder | string $query, string $as ) : Builder | static Add a subselect expression to the query.
setBindings ( array $bindings, string $type = 'where' ) Set the bindings on the query builder.
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.
sharedLock ( ) : Builder Share lock the selected rows in the table.
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.
skip ( integer $value ) : Builder | static Alias to set the "offset" value of the query.
sum ( string $column ) : float | integer Retrieve the sum of the values of a given column.
take ( integer $value ) : Builder | static Alias to set the "limit" value of the query.
toBase ( ) : Builder Get a base query builder instance.
toSql ( ) : string Get the SQL representation of the query.
truncate ( ) : void Run a truncate statement on the table.
union ( Builder | Closure $query, boolean $all = false ) : Builder | static Add a union statement to the query.
unionAll ( Builder | Closure $query ) : Builder | static Add a union all statement to the query.
updateOrCreate ( array $attributes, array $values = [] ) : Model Create or update a record matching the attributes, and fill it with values.
updateOrInsert ( array $attributes, array $values = [] ) : boolean Insert or update a record matching the attributes, and fill it with values.
useWritePdo ( ) Use the write pdo for query.
value ( string $column ) : mixed Get a single column's value from the first result of a query.
when ( boolean $value, Closure $callback ) Apply the callback's query changes if the given "value" is true.
where ( string $column, string $operator = null, mixed $value = null, string $boolean = 'and' ) Add a basic where clause to the query.
whereBetween ( string $column, array $values, string $boolean = 'and', boolean $not = false ) Add a where between statement to the query.
whereColumn ( string | array $first, string | null $operator = null, string | null $second = null, string | null $boolean = 'and' ) : Builder | static Add a "where" clause comparing two columns to the query.
whereDate ( string $column, string $operator, integer $value, string $boolean = 'and' ) : Builder | static Add a "where date" statement to the query.
whereDay ( string $column, string $operator, integer $value, string $boolean = 'and' ) : Builder | static Add a "where day" statement to the query.
whereDoesntHave ( string $relation, Closure | null $callback = null ) : Builder | static Add a relationship count / exists condition to the query with where clauses.
whereExists ( Closure $callback, string $boolean = 'and', boolean $not = false ) Add an exists clause to the query.
whereHas ( string $relation, Closure $callback, string $operator = '>=', integer $count = 1 ) : Builder | static Add a relationship count / exists condition to the query with where clauses.
whereIn ( string $column, mixed $values, string $boolean = 'and', boolean $not = false ) Add a "where in" clause to the query.
whereMonth ( string $column, string $operator, integer $value, string $boolean = 'and' ) : Builder | static Add a "where month" statement to the query.
whereNested ( Closure $callback, string $boolean = 'and' ) : Builder | static Add a nested where statement to the query.
whereNotBetween ( string $column, array $values, string $boolean = 'and' ) : Builder | static Add a where not between statement to the query.
whereNotExists ( Closure $callback, string $boolean = 'and' ) : Builder | static Add a where not exists clause to the query.
whereNotIn ( string $column, mixed $values, string $boolean = 'and' ) : Builder | static Add a "where not in" clause to the query.
whereNotNull ( string $column, string $boolean = 'and' ) : Builder | static Add a "where not null" clause to the query.
whereNull ( string $column, string $boolean = 'and', boolean $not = false ) Add a "where null" clause to the query.
whereRaw ( string $sql, array $bindings = [], string $boolean = 'and' ) Add a raw where clause to the query.
whereTime ( string $column, string $operator, integer $value, string $boolean = 'and' ) : Builder | static Add a "where time" statement to the query.
whereYear ( string $column, string $operator, integer $value, string $boolean = 'and' ) : Builder | static Add a "where year" statement to the query.
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 | null $scopes = null ) Remove all or passed registered global scopes.

Method Details

addBinding() public static method

Add a binding to the query.
public static addBinding ( mixed $value, string $type = 'where' )
$value mixed
$type string

addNestedWhereQuery() public static method

Add another query builder as a nested where to the query builder.
public static addNestedWhereQuery ( Builder | static $query, string $boolean = 'and' )
$query Illuminate\Database\Query\Builder | static
$boolean string

addSelect() public static method

Add a new select column to the query.
public static addSelect ( array | mixed $column )
$column array | mixed

addWhereExistsQuery() public static method

Add an exists clause to the query.
public static addWhereExistsQuery ( Builder $query, string $boolean = 'and', boolean $not = false )
$query Illuminate\Database\Query\Builder
$boolean string
$not boolean

aggregate() public static method

Execute an aggregate function on the database.
public static aggregate ( string $function, array $columns = [] ) : float | integer
$function string
$columns array
return float | integer

applyScopes() public static method

Apply the scopes to the Eloquent builder instance and return it.
public static applyScopes ( ) : Builder | static
return Illuminate\Database\Eloquent\Builder | static

average() public static method

Alias for the "avg" method.
public static average ( string $column ) : float | integer
$column string
return float | integer

avg() public static method

Retrieve the average of the values of a given column.
public static avg ( string $column ) : float | integer
$column string
return float | integer

chunk() public static method

Chunk the results of the query.
public static chunk ( integer $count, callable $callback ) : boolean
$count integer
$callback callable
return boolean

chunkById() public static method

Chunk the results of a query by comparing numeric IDs.
public static chunkById ( integer $count, callable $callback, string $column = 'id' ) : boolean
$count integer
$callback callable
$column string
return boolean

count() public static method

Retrieve the "count" result of the query.
public static count ( string $columns = '*' ) : integer
$columns string
return integer

crossJoin() public static method

Add a "cross join" clause to the query.
public static crossJoin ( string $table, string $first = null, string $operator = null, string $second = null ) : Builder | static
$table string
$first string
$operator string
$second string
return Illuminate\Database\Query\Builder | static

cursor() public static method

Get a generator for the given query.
public static cursor ( ) : Generator
return Generator

distinct() public static method

Force the query to only return distinct results.
public static distinct ( )

doesntHave() public static method

Add a relationship count / exists condition to the query.
public static doesntHave ( string $relation, string $boolean = 'and', Closure | null $callback = null ) : Builder | static
$relation string
$boolean string
$callback Closure | null
return Illuminate\Database\Eloquent\Builder | static

dynamicWhere() public static method

Handles dynamic "where" clauses to the query.
public static dynamicWhere ( string $method, string $parameters )
$method string
$parameters string

each() public static method

Execute a callback over each item while chunking.
public static each ( callable $callback, integer $count = 1000 ) : boolean
$callback callable
$count integer
return boolean

eagerLoadRelations() public static method

Eager load the relationships for the models.
public static eagerLoadRelations ( array $models ) : array
$models array
return array

exists() public static method

Determine if any rows exist for the current query.
public static exists ( ) : boolean
return boolean

find() public static method

Find a model by its primary key.
public static find ( mixed $id, array $columns = [] ) : Model | Illuminate\Database\Eloquent\Collection | static[] | static | null
$id mixed
$columns array
return Illuminate\Database\Eloquent\Model | Illuminate\Database\Eloquent\Collection | static[] | static | null

findMany() public static method

Find multiple models by their primary keys.
public static findMany ( array $ids, array $columns = [] ) : Illuminate\Database\Eloquent\Collection
$ids array
$columns array
return Illuminate\Database\Eloquent\Collection

findOrFail() public static method

Find a model by its primary key or throw an exception.
public static findOrFail ( mixed $id, array $columns = [] ) : Model | Illuminate\Database\Eloquent\Collection
$id mixed
$columns array
return Illuminate\Database\Eloquent\Model | Illuminate\Database\Eloquent\Collection

findOrNew() public static method

Find a model by its primary key or return fresh model instance.
public static findOrNew ( mixed $id, array $columns = [] ) : Model
$id mixed
$columns array
return Illuminate\Database\Eloquent\Model

first() public static method

Execute the query and get the first result.
public static first ( array $columns = [] ) : Model | static | null
$columns array
return Illuminate\Database\Eloquent\Model | static | null

firstOrCreate() public static method

Get the first record matching the attributes or create it.
public static firstOrCreate ( array $attributes ) : Model
$attributes array
return Illuminate\Database\Eloquent\Model

firstOrFail() public static method

Execute the query and get the first result or throw an exception.
public static firstOrFail ( array $columns = [] ) : Model | static
$columns array
return Illuminate\Database\Eloquent\Model | static

firstOrNew() public static method

Get the first record matching the attributes or instantiate it.
public static firstOrNew ( array $attributes ) : Model
$attributes array
return Illuminate\Database\Eloquent\Model

forNestedWhere() public static method

Create a new query instance for nested where condition.
public static forNestedWhere ( ) : Builder
return Illuminate\Database\Query\Builder

forPage() public static method

Set the limit and offset for a given page.
public static forPage ( integer $page, integer $perPage = 15 ) : Builder | static
$page integer
$perPage integer
return Illuminate\Database\Query\Builder | static

forPageAfterId() public static method

Constrain the query to the next "page" of results after a given ID.
public static forPageAfterId ( integer $perPage = 15, integer $lastId, string $column = 'id' ) : Builder | static
$perPage integer
$lastId integer
$column string
return Illuminate\Database\Query\Builder | static

from() public static method

Set the table which the query is targeting.
public static from ( string $table )
$table string

get() public static method

Execute the query as a "select" statement.
public static get ( array $columns = [] ) : Illuminate\Database\Eloquent\Collection | static[]
$columns array
return Illuminate\Database\Eloquent\Collection | static[]

getBindings() public static method

Get the current query value bindings in a flattened array.
public static getBindings ( ) : array
return array

getCountForPagination() public static method

Get the count of the total records for the paginator.
public static getCountForPagination ( array $columns = [] ) : integer
$columns array
return integer

getEagerLoads() public static method

Get the relationships being eagerly loaded.
public static getEagerLoads ( ) : array
return array

getGrammar() public static method

Get the query grammar instance.
public static getGrammar ( ) : Illuminate\Database\Query\Grammars\Grammar
return Illuminate\Database\Query\Grammars\Grammar

getMacro() public static method

Get the given macro by name.
public static getMacro ( string $name ) : Closure
$name string
return Closure

getModel() public static method

Get the model instance being queried.
public static getModel ( ) : Model
return Illuminate\Database\Eloquent\Model

getModels() public static method

Get the hydrated models without eager loading.
public static getModels ( array $columns = [] ) : Model[]
$columns array
return Illuminate\Database\Eloquent\Model[]

getProcessor() public static method

Get the database query processor instance.
public static getProcessor ( ) : Illuminate\Database\Query\Processors\Processor
return Illuminate\Database\Query\Processors\Processor

getQuery() public static method

Get the underlying query builder instance.
public static getQuery ( ) : Builder
return Illuminate\Database\Query\Builder

getRawBindings() public static method

Get the raw array of bindings.
public static getRawBindings ( ) : array
return array

groupBy() public static method

Add a "group by" clause to the query.
public static groupBy ( )

has() public static method

Add a relationship count / exists condition to the query.
public static has ( string $relation, string $operator = '>=', integer $count = 1, string $boolean = 'and', Closure | null $callback = null ) : Builder | static
$relation string
$operator string
$count integer
$boolean string
$callback Closure | null
return Illuminate\Database\Eloquent\Builder | static

hasMacro() public static method

Checks if macro is registered.
public static hasMacro ( string $name ) : boolean
$name string
return boolean

having() public static method

Add a "having" clause to the query.
public static having ( string $column, string $operator = null, string $value = null, string $boolean = 'and' )
$column string
$operator string
$value string
$boolean string

havingRaw() public static method

Add a raw having clause to the query.
public static havingRaw ( string $sql, array $bindings = [], string $boolean = 'and' )
$sql string
$bindings array
$boolean string

implode() public static method

Concatenate values of a given column as a string.
public static implode ( string $column, string $glue = '' ) : string
$column string
$glue string
return string

inRandomOrder() public static method

Put the query's results in random order.
public static inRandomOrder ( string $seed = '' )
$seed string

insert() public static method

Insert a new record into the database.
public static insert ( array $values ) : boolean
$values array
return boolean

insertGetId() public static method

Insert a new record and get the value of the primary key.
public static insertGetId ( array $values, string $sequence = null ) : integer
$values array
$sequence string
return integer

join() public static method

Add a join clause to the query.
public static join ( string $table, string $one, string $operator = null, string $two = null, string $type = 'inner', boolean $where = false )
$table string
$one string
$operator string
$two string
$type string
$where boolean

joinWhere() public static method

Add a "join where" clause to the query.
public static joinWhere ( string $table, string $one, string $operator, string $two, string $type = 'inner' ) : Builder | static
$table string
$one string
$operator string
$two string
$type string
return Illuminate\Database\Query\Builder | static

latest() public static method

Add an "order by" clause for a timestamp to the query.
public static latest ( string $column = 'created_at' ) : Builder | static
$column string
return Illuminate\Database\Query\Builder | static

leftJoin() public static method

Add a left join to the query.
public static leftJoin ( string $table, string $first, string $operator = null, string $second = null ) : Builder | static
$table string
$first string
$operator string
$second string
return Illuminate\Database\Query\Builder | static

leftJoinWhere() public static method

Add a "join where" clause to the query.
public static leftJoinWhere ( string $table, string $one, string $operator, string $two ) : Builder | static
$table string
$one string
$operator string
$two string
return Illuminate\Database\Query\Builder | static

limit() public static method

Set the "limit" value of the query.
public static limit ( integer $value )
$value integer

lists() public static method

Alias for the "pluck" method.
Deprecation: since version 5.2. Use the "pluck" method directly.
public static lists ( string $column, string $key = null ) : Collection
$column string
$key string
return Illuminate\Support\Collection

lock() public static method

Lock the selected rows in the table.
public static lock ( boolean $value = true )
$value boolean

lockForUpdate() public static method

Lock the selected rows in the table for updating.
public static lockForUpdate ( ) : Builder
return Illuminate\Database\Query\Builder

macro() public static method

Extend the builder with a given callback.
public static macro ( string $name, Closure $callback ) : void
$name string
$callback Closure
return void

macroCall() public static method

Dynamically handle calls to the class.
public static macroCall ( string $method, array $parameters ) : mixed
$method string
$parameters array
return mixed

max() public static method

Retrieve the maximum value of a given column.
public static max ( string $column ) : float | integer
$column string
return float | integer

mergeBindings() public static method

Merge an array of bindings into our bindings.
public static mergeBindings ( Builder $query )
$query Illuminate\Database\Query\Builder

mergeModelDefinedRelationConstraints() public static method

Merge the constraints from a relation query to the current query.
public static mergeModelDefinedRelationConstraints ( Builder $relation ) : Builder | static
$relation Illuminate\Database\Eloquent\Builder
return Illuminate\Database\Eloquent\Builder | static

mergeWheres() public static method

Merge an array of where clauses and bindings.
public static mergeWheres ( array $wheres, array $bindings ) : void
$wheres array
$bindings array
return void

min() public static method

Retrieve the minimum value of a given column.
public static min ( string $column ) : float | integer
$column string
return float | integer

offset() public static method

Set the "offset" value of the query.
public static offset ( integer $value )
$value integer

oldest() public static method

Add an "order by" clause for a timestamp to the query.
public static oldest ( string $column = 'created_at' ) : Builder | static
$column string
return Illuminate\Database\Query\Builder | static

onDelete() public static method

Register a replacement for the default delete function.
public static onDelete ( Closure $callback ) : void
$callback Closure
return void

orHas() public static method

Add a relationship count / exists condition to the query with an "or".
public static orHas ( string $relation, string $operator = '>=', integer $count = 1 ) : Builder | static
$relation string
$operator string
$count integer
return Illuminate\Database\Eloquent\Builder | static

orHaving() public static method

Add a "or having" clause to the query.
public static orHaving ( string $column, string $operator = null, string $value = null ) : Builder | static
$column string
$operator string
$value string
return Illuminate\Database\Query\Builder | static

orHavingRaw() public static method

Add a raw or having clause to the query.
public static orHavingRaw ( string $sql, array $bindings = [] ) : Builder | static
$sql string
$bindings array
return Illuminate\Database\Query\Builder | static

orWhere() public static method

Add an "or where" clause to the query.
public static orWhere ( string $column, string $operator = null, mixed $value = null ) : Builder | static
$column string
$operator string
$value mixed
return Illuminate\Database\Eloquent\Builder | static

orWhereBetween() public static method

Add an or where between statement to the query.
public static orWhereBetween ( string $column, array $values ) : Builder | static
$column string
$values array
return Illuminate\Database\Query\Builder | static

orWhereColumn() public static method

Add an "or where" clause comparing two columns to the query.
public static orWhereColumn ( string | array $first, string | null $operator = null, string | null $second = null ) : Builder | static
$first string | array
$operator string | null
$second string | null
return Illuminate\Database\Query\Builder | static

orWhereDate() public static method

Add an "or where date" statement to the query.
public static orWhereDate ( string $column, string $operator, integer $value ) : Builder | static
$column string
$operator string
$value integer
return Illuminate\Database\Query\Builder | static

orWhereExists() public static method

Add an or exists clause to the query.
public static orWhereExists ( Closure $callback, boolean $not = false ) : Builder | static
$callback Closure
$not boolean
return Illuminate\Database\Query\Builder | static

orWhereHas() public static method

Add a relationship count / exists condition to the query with where clauses and an "or".
public static orWhereHas ( string $relation, Closure $callback, string $operator = '>=', integer $count = 1 ) : Builder | static
$relation string
$callback Closure
$operator string
$count integer
return Illuminate\Database\Eloquent\Builder | static

orWhereIn() public static method

Add an "or where in" clause to the query.
public static orWhereIn ( string $column, mixed $values ) : Builder | static
$column string
$values mixed
return Illuminate\Database\Query\Builder | static

orWhereNotBetween() public static method

Add an or where not between statement to the query.
public static orWhereNotBetween ( string $column, array $values ) : Builder | static
$column string
$values array
return Illuminate\Database\Query\Builder | static

orWhereNotExists() public static method

Add a where not exists clause to the query.
public static orWhereNotExists ( Closure $callback ) : Builder | static
$callback Closure
return Illuminate\Database\Query\Builder | static

orWhereNotIn() public static method

Add an "or where not in" clause to the query.
public static orWhereNotIn ( string $column, mixed $values ) : Builder | static
$column string
$values mixed
return Illuminate\Database\Query\Builder | static

orWhereNotNull() public static method

Add an "or where not null" clause to the query.
public static orWhereNotNull ( string $column ) : Builder | static
$column string
return Illuminate\Database\Query\Builder | static

orWhereNull() public static method

Add an "or where null" clause to the query.
public static orWhereNull ( string $column ) : Builder | static
$column string
return Illuminate\Database\Query\Builder | static

orWhereRaw() public static method

Add a raw or where clause to the query.
public static orWhereRaw ( string $sql, array $bindings = [] ) : Builder | static
$sql string
$bindings array
return Illuminate\Database\Query\Builder | static

orWhereTime() public static method

Add an "or where time" statement to the query.
public static orWhereTime ( string $column, string $operator, integer $value ) : Builder | static
$column string
$operator string
$value integer
return Illuminate\Database\Query\Builder | static

orderBy() public static method

Add an "order by" clause to the query.
public static orderBy ( string $column, string $direction = 'asc' )
$column string
$direction string

orderByRaw() public static method

Add a raw "order by" clause to the query.
public static orderByRaw ( string $sql, array $bindings = [] )
$sql string
$bindings array

paginate() public static method

Paginate the given query.
public static paginate ( integer $perPage = null, array $columns = [], string $pageName = 'page', integer | null $page = null ) : Illuminate\Contracts\Pagination\LengthAwarePaginator
$perPage integer
$columns array
$pageName string
$page integer | null
return Illuminate\Contracts\Pagination\LengthAwarePaginator

pluck() public static method

Get an array with the values of a given column.
public static pluck ( string $column, string | null $key = null ) : Collection
$column string
$key string | null
return Illuminate\Support\Collection

raw() public static method

Create a raw database expression.
public static raw ( mixed $value ) : Illuminate\Database\Query\Expression
$value mixed
return Illuminate\Database\Query\Expression

removedScopes() public static method

Get an array of global scopes that were removed from the query.
public static removedScopes ( ) : array
return array

rightJoin() public static method

Add a right join to the query.
public static rightJoin ( string $table, string $first, string $operator = null, string $second = null ) : Builder | static
$table string
$first string
$operator string
$second string
return Illuminate\Database\Query\Builder | static

rightJoinWhere() public static method

Add a "right join where" clause to the query.
public static rightJoinWhere ( string $table, string $one, string $operator, string $two ) : Builder | static
$table string
$one string
$operator string
$two string
return Illuminate\Database\Query\Builder | static

scopes() public static method

Add the given scopes to the current builder instance.
public static scopes ( array $scopes ) : mixed
$scopes array
return mixed

select() public static method

Set the columns to be selected.
public static select ( array | mixed $columns = [] )
$columns array | mixed

selectRaw() public static method

Add a new "raw" select expression to the query.
public static selectRaw ( string $expression, array $bindings = [] ) : Builder | static
$expression string
$bindings array
return Illuminate\Database\Query\Builder | static

selectSub() public static method

Add a subselect expression to the query.
public static selectSub ( Closure | Builder | string $query, string $as ) : Builder | static
$query Closure | Illuminate\Database\Query\Builder | string
$as string
return Illuminate\Database\Query\Builder | static

setBindings() public static method

Set the bindings on the query builder.
public static setBindings ( array $bindings, string $type = 'where' )
$bindings array
$type string

setEagerLoads() public static method

Set the relationships being eagerly loaded.
public static setEagerLoads ( array $eagerLoad )
$eagerLoad array

setModel() public static method

Set a model instance for the model being queried.
public static setModel ( Model $model )
$model Illuminate\Database\Eloquent\Model

setQuery() public static method

Set the underlying query builder instance.
public static setQuery ( Builder $query )
$query Illuminate\Database\Query\Builder

sharedLock() public static method

Share lock the selected rows in the table.
public static sharedLock ( ) : Builder
return Illuminate\Database\Query\Builder

simplePaginate() public static method

Paginate the given query into a simple paginator.
public static simplePaginate ( integer $perPage = null, array $columns = [], string $pageName = 'page', integer | null $page = null ) : Illuminate\Contracts\Pagination\Paginator
$perPage integer
$columns array
$pageName string
$page integer | null
return Illuminate\Contracts\Pagination\Paginator

skip() public static method

Alias to set the "offset" value of the query.
public static skip ( integer $value ) : Builder | static
$value integer
return Illuminate\Database\Query\Builder | static

sum() public static method

Retrieve the sum of the values of a given column.
public static sum ( string $column ) : float | integer
$column string
return float | integer

take() public static method

Alias to set the "limit" value of the query.
public static take ( integer $value ) : Builder | static
$value integer
return Illuminate\Database\Query\Builder | static

toBase() public static method

Get a base query builder instance.
public static toBase ( ) : Builder
return Illuminate\Database\Query\Builder

toSql() public static method

Get the SQL representation of the query.
public static toSql ( ) : string
return string

truncate() public static method

Run a truncate statement on the table.
public static truncate ( ) : void
return void

union() public static method

Add a union statement to the query.
public static union ( Builder | Closure $query, boolean $all = false ) : Builder | static
$query Illuminate\Database\Query\Builder | Closure
$all boolean
return Illuminate\Database\Query\Builder | static

unionAll() public static method

Add a union all statement to the query.
public static unionAll ( Builder | Closure $query ) : Builder | static
$query Illuminate\Database\Query\Builder | Closure
return Illuminate\Database\Query\Builder | static

updateOrCreate() public static method

Create or update a record matching the attributes, and fill it with values.
public static updateOrCreate ( array $attributes, array $values = [] ) : Model
$attributes array
$values array
return Illuminate\Database\Eloquent\Model

updateOrInsert() public static method

Insert or update a record matching the attributes, and fill it with values.
public static updateOrInsert ( array $attributes, array $values = [] ) : boolean
$attributes array
$values array
return boolean

useWritePdo() public static method

Use the write pdo for query.
public static useWritePdo ( )

value() public static method

Get a single column's value from the first result of a query.
public static value ( string $column ) : mixed
$column string
return mixed

when() public static method

Apply the callback's query changes if the given "value" is true.
public static when ( boolean $value, Closure $callback )
$value boolean
$callback Closure

where() public static method

Add a basic where clause to the query.
public static where ( string $column, string $operator = null, mixed $value = null, string $boolean = 'and' )
$column string
$operator string
$value mixed
$boolean string

whereBetween() public static method

Add a where between statement to the query.
public static whereBetween ( string $column, array $values, string $boolean = 'and', boolean $not = false )
$column string
$values array
$boolean string
$not boolean

whereColumn() public static method

Add a "where" clause comparing two columns to the query.
public static whereColumn ( string | array $first, string | null $operator = null, string | null $second = null, string | null $boolean = 'and' ) : Builder | static
$first string | array
$operator string | null
$second string | null
$boolean string | null
return Illuminate\Database\Query\Builder | static

whereDate() public static method

Add a "where date" statement to the query.
public static whereDate ( string $column, string $operator, integer $value, string $boolean = 'and' ) : Builder | static
$column string
$operator string
$value integer
$boolean string
return Illuminate\Database\Query\Builder | static

whereDay() public static method

Add a "where day" statement to the query.
public static whereDay ( string $column, string $operator, integer $value, string $boolean = 'and' ) : Builder | static
$column string
$operator string
$value integer
$boolean string
return Illuminate\Database\Query\Builder | static

whereDoesntHave() public static method

Add a relationship count / exists condition to the query with where clauses.
public static whereDoesntHave ( string $relation, Closure | null $callback = null ) : Builder | static
$relation string
$callback Closure | null
return Illuminate\Database\Eloquent\Builder | static

whereExists() public static method

Add an exists clause to the query.
public static whereExists ( Closure $callback, string $boolean = 'and', boolean $not = false )
$callback Closure
$boolean string
$not boolean

whereHas() public static method

Add a relationship count / exists condition to the query with where clauses.
public static whereHas ( string $relation, Closure $callback, string $operator = '>=', integer $count = 1 ) : Builder | static
$relation string
$callback Closure
$operator string
$count integer
return Illuminate\Database\Eloquent\Builder | static

whereIn() public static method

Add a "where in" clause to the query.
public static whereIn ( string $column, mixed $values, string $boolean = 'and', boolean $not = false )
$column string
$values mixed
$boolean string
$not boolean

whereMonth() public static method

Add a "where month" statement to the query.
public static whereMonth ( string $column, string $operator, integer $value, string $boolean = 'and' ) : Builder | static
$column string
$operator string
$value integer
$boolean string
return Illuminate\Database\Query\Builder | static

whereNested() public static method

Add a nested where statement to the query.
public static whereNested ( Closure $callback, string $boolean = 'and' ) : Builder | static
$callback Closure
$boolean string
return Illuminate\Database\Query\Builder | static

whereNotBetween() public static method

Add a where not between statement to the query.
public static whereNotBetween ( string $column, array $values, string $boolean = 'and' ) : Builder | static
$column string
$values array
$boolean string
return Illuminate\Database\Query\Builder | static

whereNotExists() public static method

Add a where not exists clause to the query.
public static whereNotExists ( Closure $callback, string $boolean = 'and' ) : Builder | static
$callback Closure
$boolean string
return Illuminate\Database\Query\Builder | static

whereNotIn() public static method

Add a "where not in" clause to the query.
public static whereNotIn ( string $column, mixed $values, string $boolean = 'and' ) : Builder | static
$column string
$values mixed
$boolean string
return Illuminate\Database\Query\Builder | static

whereNotNull() public static method

Add a "where not null" clause to the query.
public static whereNotNull ( string $column, string $boolean = 'and' ) : Builder | static
$column string
$boolean string
return Illuminate\Database\Query\Builder | static

whereNull() public static method

Add a "where null" clause to the query.
public static whereNull ( string $column, string $boolean = 'and', boolean $not = false )
$column string
$boolean string
$not boolean

whereRaw() public static method

Add a raw where clause to the query.
public static whereRaw ( string $sql, array $bindings = [], string $boolean = 'and' )
$sql string
$bindings array
$boolean string

whereTime() public static method

Add a "where time" statement to the query.
public static whereTime ( string $column, string $operator, integer $value, string $boolean = 'and' ) : Builder | static
$column string
$operator string
$value integer
$boolean string
return Illuminate\Database\Query\Builder | static

whereYear() public static method

Add a "where year" statement to the query.
public static whereYear ( string $column, string $operator, integer $value, string $boolean = 'and' ) : Builder | static
$column string
$operator string
$value integer
$boolean string
return Illuminate\Database\Query\Builder | static

withCount() public static method

Add subselect queries to count the relations.
public static withCount ( mixed $relations )
$relations mixed

withGlobalScope() public static method

Register a new global scope.
public static withGlobalScope ( string $identifier, Illuminate\Database\Eloquent\Scope | Closure $scope )
$identifier string
$scope Illuminate\Database\Eloquent\Scope | Closure

without() public static method

Prevent the specified relations from being eager loaded.
public static without ( mixed $relations )
$relations mixed

withoutGlobalScope() public static method

Remove a registered global scope.
public static withoutGlobalScope ( Illuminate\Database\Eloquent\Scope | string $scope )
$scope Illuminate\Database\Eloquent\Scope | string

withoutGlobalScopes() public static method

Remove all or passed registered global scopes.
public static withoutGlobalScopes ( array | null $scopes = null )
$scopes array | null