W3cubDocs

/Laravel 5.2

JoinClause

class JoinClause (View source)

Properties

string $type The type of join being performed.
string $table The table the join clause is joining to.
array $clauses The "on" clauses for the join.
array $bindings The "on" bindings for the join.

Methods

void __construct( string $type, string $table)

Create a new join clause instance.

$this on( Closure|string $first, string|null $operator = null, string|null $second = null, string $boolean = 'and', bool $where = false)

Add an "on" clause to the join.

JoinClause orOn( Closure|string $first, string|null $operator = null, string|null $second = null)

Add an "or on" clause to the join.

JoinClause where( Closure|string $first, string|null $operator = null, string|null $second = null, string $boolean = 'and')

Add an "on where" clause to the join.

JoinClause orWhere( Closure|string $first, string|null $operator = null, string|null $second = null)

Add an "or on where" clause to the join.

JoinClause whereNull( string $column, string $boolean = 'and')

Add an "on where is null" clause to the join.

JoinClause orWhereNull( string $column)

Add an "or on where is null" clause to the join.

JoinClause whereNotNull( string $column, string $boolean = 'and')

Add an "on where is not null" clause to the join.

JoinClause orWhereNotNull( string $column)

Add an "or on where is not null" clause to the join.

JoinClause whereIn( string $column, array $values)

Add an "on where in (.

JoinClause whereNotIn( string $column, array $values)

Add an "on where not in (.

JoinClause orWhereIn( string $column, array $values)

Add an "or on where in (.

JoinClause orWhereNotIn( string $column, array $values)

Add an "or on where not in (.

JoinClause nest( Closure $callback, string $boolean = 'and')

Add a nested where statement to the query.

Details

void __construct( string $type, string $table)

Create a new join clause instance.

Parameters

string $type
string $table

Return Value

void

$this on( Closure|string $first, string|null $operator = null, string|null $second = null, string $boolean = 'and', bool $where = false)

Add an "on" clause to the join.

On clauses can be chained, e.g.

$join->on('contacts.userid', '=', 'users.id') ->on('contacts.infoid', '=', 'info.id')

will produce the following SQL:

on contacts.user_id = users.id and contacts.info_id = info.id

Parameters

Closure|string $first
string|null $operator
string|null $second
string $boolean
bool $where

Return Value

$this

Exceptions

InvalidArgumentException

JoinClause orOn( Closure|string $first, string|null $operator = null, string|null $second = null)

Add an "or on" clause to the join.

Parameters

Closure|string $first
string|null $operator
string|null $second

Return Value

JoinClause

JoinClause where( Closure|string $first, string|null $operator = null, string|null $second = null, string $boolean = 'and')

Add an "on where" clause to the join.

Parameters

Closure|string $first
string|null $operator
string|null $second
string $boolean

Return Value

JoinClause

JoinClause orWhere( Closure|string $first, string|null $operator = null, string|null $second = null)

Add an "or on where" clause to the join.

Parameters

Closure|string $first
string|null $operator
string|null $second

Return Value

JoinClause

JoinClause whereNull( string $column, string $boolean = 'and')

Add an "on where is null" clause to the join.

Parameters

string $column
string $boolean

Return Value

JoinClause

JoinClause orWhereNull( string $column)

Add an "or on where is null" clause to the join.

Parameters

string $column

Return Value

JoinClause

JoinClause whereNotNull( string $column, string $boolean = 'and')

Add an "on where is not null" clause to the join.

Parameters

string $column
string $boolean

Return Value

JoinClause

JoinClause orWhereNotNull( string $column)

Add an "or on where is not null" clause to the join.

Parameters

string $column

Return Value

JoinClause

JoinClause whereIn( string $column, array $values)

Add an "on where in (.

..)" clause to the join.

Parameters

string $column
array $values

Return Value

JoinClause

JoinClause whereNotIn( string $column, array $values)

Add an "on where not in (.

..)" clause to the join.

Parameters

string $column
array $values

Return Value

JoinClause

JoinClause orWhereIn( string $column, array $values)

Add an "or on where in (.

..)" clause to the join.

Parameters

string $column
array $values

Return Value

JoinClause

JoinClause orWhereNotIn( string $column, array $values)

Add an "or on where not in (.

..)" clause to the join.

Parameters

string $column
array $values

Return Value

JoinClause

JoinClause nest( Closure $callback, string $boolean = 'and')

Add a nested where statement to the query.

Parameters

Closure $callback
string $boolean

Return Value

JoinClause

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.2/Illuminate/Database/Query/JoinClause.html