Properties

$connection

$connection : \Laravel\Database\Connection

The database connection.

Type

LaravelDatabaseConnection

Tags

None found

$grammar

$grammar : \Laravel\Database\Query\Grammars\Grammar

The query grammar instance.

Type

LaravelDatabaseQueryGrammarsGrammar

Tags

None found

$selects

$selects : array

The SELECT clause.

Type

array

Tags

None found

$aggregate

$aggregate : array

The aggregating column and function.

Type

array

Tags

None found

$distinct

$distinct : boolean

Indicates if the query should return distinct results.

Type

boolean

Tags

None found

$from

$from : string

The table name.

Type

string

Tags

None found

$joins

$joins : array

The table joins.

Type

array

Tags

None found

$wheres

$wheres : array

The WHERE clauses.

Type

array

Tags

None found

$groupings

$groupings : array

The GROUP BY clauses.

Type

array

Tags

None found

$havings

$havings : array

The HAVING clauses.

Type

array

Tags

None found

$orderings

$orderings : array

The ORDER BY clauses.

Type

array

Tags

None found

$limit

$limit : integer

The LIMIT value.

Type

integer

Tags

None found

$offset

$offset : integer

The OFFSET value.

Type

integer

Tags

None found

$bindings

$bindings : array

The query value bindings.

Type

array

Tags

None found

Methods

__construct()

__construct(\Laravel\Database\Connection  $connection, \Laravel\Database\Grammar  $grammar, string  $table) : void

Create a new query instance.

Parameters

LaravelDatabaseConnection $connection
LaravelDatabaseGrammar $grammar
string $table

Tags

None found

distinct()

distinct() : \Laravel\Database\Query

Force the query to return distinct results.

Returns

LaravelDatabaseQuery

Tags

None found

select()

select(array  $columns = array('*')) : \Laravel\Database\Query

Add an array of columns to the SELECT clause.

Parameters

array $columns

Returns

LaravelDatabaseQuery

Tags

None found

join()

join(string  $table, string  $column1, string  $operator = null, string  $column2 = null, string  $type = 'INNER') : \Laravel\Database\Query

Add a join clause to the query.

Parameters

string $table
string $column1
string $operator
string $column2
string $type

Returns

LaravelDatabaseQuery

Tags

None found

left_join()

left_join(string  $table, string  $column1, string  $operator = null, string  $column2 = null) : \Laravel\Database\Query

Add a left join to the query.

Parameters

string $table
string $column1
string $operator
string $column2

Returns

LaravelDatabaseQuery

Tags

None found

reset_where()

reset_where() : void

Reset the where clause to its initial state.

Tags

None found

raw_where()

raw_where(string  $where, array  $bindings = array(), string  $connector = 'AND') : \Laravel\Database\Query

Add a raw where condition to the query.

Parameters

string $where
array $bindings
string $connector

Returns

LaravelDatabaseQuery

Tags

None found

raw_or_where()

raw_or_where(string  $where, array  $bindings = array()) : \Laravel\Database\Query

Add a raw or where condition to the query.

Parameters

string $where
array $bindings

Returns

LaravelDatabaseQuery

Tags

None found

where()

where(string  $column, string  $operator = null, mixed  $value = null, string  $connector = 'AND') : \Laravel\Database\Query

Add a where condition to the query.

Parameters

string $column
string $operator
mixed $value
string $connector

Returns

LaravelDatabaseQuery

Tags

None found

or_where()

or_where(string  $column, string  $operator = null, mixed  $value = null) : \Laravel\Database\Query

Add an or where condition to the query.

Parameters

string $column
string $operator
mixed $value

Returns

LaravelDatabaseQuery

Tags

None found

or_where_id()

or_where_id(mixed  $value) : \Laravel\Database\Query

Add an or where condition for the primary key to the query.

Parameters

mixed $value

Returns

LaravelDatabaseQuery

Tags

None found

where_in()

where_in(string  $column, array  $values, string  $connector = 'AND', boolean  $not = false) : \Laravel\Database\Query

Add a where in condition to the query.

Parameters

string $column
array $values
string $connector
boolean $not

Returns

LaravelDatabaseQuery

Tags

None found

or_where_in()

or_where_in(string  $column, array  $values) : \Laravel\Database\Query

Add an or where in condition to the query.

Parameters

string $column
array $values

Returns

LaravelDatabaseQuery

Tags

None found

where_not_in()

where_not_in(string  $column, array  $values, string  $connector = 'AND') : \Laravel\Database\Query

Add a where not in condition to the query.

Parameters

string $column
array $values
string $connector

Returns

LaravelDatabaseQuery

Tags

None found

or_where_not_in()

or_where_not_in(string  $column, array  $values) : \Laravel\Database\Query

Add an or where not in condition to the query.

Parameters

string $column
array $values

Returns

LaravelDatabaseQuery

Tags

None found

where_between()

where_between(string  $column, mixed  $min, mixed  $max, string  $connector = 'AND', boolean  $not = false) : \Laravel\Database\Query

Add a BETWEEN condition to the query

Parameters

string $column
mixed $min
mixed $max
string $connector
boolean $not

Returns

LaravelDatabaseQuery

Tags

None found

or_where_between()

or_where_between(string  $column, mixed  $min, mixed  $max) : \Laravel\Database\Query

Add a OR BETWEEN condition to the query

Parameters

string $column
mixed $min
mixed $max

Returns

LaravelDatabaseQuery

Tags

None found

where_not_between()

where_not_between(string  $column, mixed  $min, mixed  $max,   $connector = 'AND') : \Laravel\Database\Query

Add a NOT BETWEEN condition to the query

Parameters

string $column
mixed $min
mixed $max
$connector

Returns

LaravelDatabaseQuery

Tags

None found

or_where_not_between()

or_where_not_between(string  $column, mixed  $min, mixed  $max) : \Laravel\Database\Query

Add a OR NOT BETWEEN condition to the query

Parameters

string $column
mixed $min
mixed $max

Returns

LaravelDatabaseQuery

Tags

None found

where_null()

where_null(string  $column, string  $connector = 'AND', boolean  $not = false) : \Laravel\Database\Query

Add a where null condition to the query.

Parameters

string $column
string $connector
boolean $not

Returns

LaravelDatabaseQuery

Tags

None found

or_where_null()

or_where_null(string  $column) : \Laravel\Database\Query

Add an or where null condition to the query.

Parameters

string $column

Returns

LaravelDatabaseQuery

Tags

None found

where_not_null()

where_not_null(string  $column, string  $connector = 'AND') : \Laravel\Database\Query

Add a where not null condition to the query.

Parameters

string $column
string $connector

Returns

LaravelDatabaseQuery

Tags

None found

or_where_not_null()

or_where_not_null(string  $column) : \Laravel\Database\Query

Add an or where not null condition to the query.

Parameters

string $column

Returns

LaravelDatabaseQuery

Tags

None found

where_nested()

where_nested(\Closure  $callback, string  $connector = 'AND') : \Laravel\Database\Query

Add a nested where condition to the query.

Parameters

Closure $callback
string $connector

Returns

LaravelDatabaseQuery

Tags

None found

group_by()

group_by(string  $column) : \Laravel\Database\Query

Add a grouping to the query.

Parameters

string $column

Returns

LaravelDatabaseQuery

Tags

None found

having()

having(string  $column, string  $operator, mixed  $value) 

Add a having to the query.

Parameters

string $column
string $operator
mixed $value

Tags

None found

order_by()

order_by(string  $column, string  $direction = 'asc') : \Laravel\Database\Query

Add an ordering to the query.

Parameters

string $column
string $direction

Returns

LaravelDatabaseQuery

Tags

None found

skip()

skip(integer  $value) : \Laravel\Database\Query

Set the query offset.

Parameters

integer $value

Returns

LaravelDatabaseQuery

Tags

None found

take()

take(integer  $value) : \Laravel\Database\Query

Set the query limit.

Parameters

integer $value

Returns

LaravelDatabaseQuery

Tags

None found

for_page()

for_page(integer  $page, integer  $per_page) : \Laravel\Database\Query

Set the query limit and offset for a given page.

Parameters

integer $page
integer $per_page

Returns

LaravelDatabaseQuery

Tags

None found

find()

find(integer  $id, array  $columns = array('*')) : object

Find a record by the primary key.

Parameters

integer $id
array $columns

Returns

object

Tags

None found

only()

only(string  $column) : mixed

Execute the query as a SELECT statement and return a single column.

Parameters

string $column

Returns

mixed

Tags

None found

first()

first(array  $columns = array('*')) : mixed

Execute the query as a SELECT statement and return the first result.

Parameters

array $columns

Returns

mixed

Tags

None found

lists()

lists(string  $column, string  $key = null) : array

Get an array with the values of a given column.

Parameters

string $column
string $key

Returns

array

Tags

None found

get()

get(array  $columns = array('*')) : array

Execute the query as a SELECT statement.

Parameters

array $columns

Returns

array

Tags

None found

aggregate()

aggregate(string  $aggregator, array  $columns) : mixed

Get an aggregate value.

Parameters

string $aggregator
array $columns

Returns

mixed

Tags

None found

paginate()

paginate(integer  $per_page = 20, array  $columns = array('*')) : \Paginator

Get the paginated query results as a Paginator instance.

Parameters

integer $per_page
array $columns

Returns

Paginator

Tags

None found

insert()

insert(array  $values) : boolean

Insert an array of values into the database table.

Parameters

array $values

Returns

boolean

Tags

None found

insert_get_id()

insert_get_id(array  $values, string  $column = 'id') : mixed

Insert an array of values into the database table and return the key.

Parameters

array $values
string $column

Returns

mixed

Tags

None found

increment()

increment(string  $column, integer  $amount = 1) : integer

Increment the value of a column by a given amount.

Parameters

string $column
integer $amount

Returns

integer

Tags

None found

decrement()

decrement(string  $column, integer  $amount = 1) : integer

Decrement the value of a column by a given amount.

Parameters

string $column
integer $amount

Returns

integer

Tags

None found

update()

update(array  $values) : integer

Update an array of values in the database table.

Parameters

array $values

Returns

integer

Tags

None found

delete()

delete(integer  $id = null) : integer

Execute the query as a DELETE statement.

Optionally, an ID may be passed to the method do delete a specific row.

Parameters

integer $id

Returns

integer

Tags

None found

__call()

__call(  $method,   $parameters) 

Magic Method for handling dynamic functions.

This method handles calls to aggregates as well as dynamic where clauses.

Parameters

$method
$parameters

Tags

None found

adjust()

adjust(string  $column, integer  $amount, string  $operator) : integer

Adjust the value of a column up or down by a given amount.

Parameters

string $column
integer $amount
string $operator

Returns

integer

Tags

None found

dynamic_where()

dynamic_where(string  $method, array  $parameters) : \Laravel\Database\Query

Add dynamic where conditions to the query.

Parameters

string $method
array $parameters

Returns

LaravelDatabaseQuery

Tags

None found