Documentation

QueriesRelationships

Table of Contents

doesntHave()  : Builder|static
Add a relationship count / exists condition to the query.
has()  : Builder|static
Add a relationship count / exists condition to the query.
mergeConstraintsFrom()  : Builder|static
Merge the where constraints from another query to the current query.
orDoesntHave()  : Builder|static
Add a relationship count / exists condition to the query with an "or".
orHas()  : Builder|static
Add a relationship count / exists condition to the query with an "or".
orWhereDoesntHave()  : Builder|static
Add a relationship count / exists condition to the query with where clauses and an "or".
orWhereHas()  : Builder|static
Add a relationship count / exists condition to the query with where clauses and an "or".
whereDoesntHave()  : Builder|static
Add a relationship count / exists condition to the query with where clauses.
whereHas()  : Builder|static
Add a relationship count / exists condition to the query with where clauses.
withCount()  : $this
Add subselect queries to count the relations.
addHasWhere()  : Builder|static
Add the "has" condition where clause to the query.
addWhereCountQuery()  : $this
Add a sub-query count clause to this query.
canUseExistsForExistenceCheck()  : bool
Check if we can run an "exists" query to optimize performance.
getRelationWithoutConstraints()  : Relation
Get the "has relation" base query instance.
hasNested()  : Builder|static
Add nested relationship count / exists conditions to the query.

Methods

doesntHave()

Add a relationship count / exists condition to the query.

public doesntHave(string $relation[, string $boolean = 'and' ][, Closure|null $callback = null ]) : Builder|static
Parameters
$relation : string
$boolean : string = 'and'
$callback : Closure|null = null
Return values
Builder|static

has()

Add a relationship count / exists condition to the query.

public has(string $relation[, string $operator = '>=' ][, int $count = 1 ][, string $boolean = 'and' ][, Closure|null $callback = null ]) : Builder|static
Parameters
$relation : string
$operator : string = '>='
$count : int = 1
$boolean : string = 'and'
$callback : Closure|null = null
Return values
Builder|static

orDoesntHave()

Add a relationship count / exists condition to the query with an "or".

public orDoesntHave(string $relation) : Builder|static
Parameters
$relation : string
Return values
Builder|static

orHas()

Add a relationship count / exists condition to the query with an "or".

public orHas(string $relation[, string $operator = '>=' ][, int $count = 1 ]) : Builder|static
Parameters
$relation : string
$operator : string = '>='
$count : int = 1
Return values
Builder|static

orWhereDoesntHave()

Add a relationship count / exists condition to the query with where clauses and an "or".

public orWhereDoesntHave(string $relation[, Closure $callback = null ]) : Builder|static
Parameters
$relation : string
$callback : Closure = null
Return values
Builder|static

orWhereHas()

Add a relationship count / exists condition to the query with where clauses and an "or".

public orWhereHas(string $relation[, Closure $callback = null ][, string $operator = '>=' ][, int $count = 1 ]) : Builder|static
Parameters
$relation : string
$callback : Closure = null
$operator : string = '>='
$count : int = 1
Return values
Builder|static

whereDoesntHave()

Add a relationship count / exists condition to the query with where clauses.

public whereDoesntHave(string $relation[, Closure|null $callback = null ]) : Builder|static
Parameters
$relation : string
$callback : Closure|null = null
Return values
Builder|static

whereHas()

Add a relationship count / exists condition to the query with where clauses.

public whereHas(string $relation[, Closure|null $callback = null ][, string $operator = '>=' ][, int $count = 1 ]) : Builder|static
Parameters
$relation : string
$callback : Closure|null = null
$operator : string = '>='
$count : int = 1
Return values
Builder|static

withCount()

Add subselect queries to count the relations.

public withCount(mixed $relations) : $this
Parameters
$relations : mixed
Return values
$this

addHasWhere()

Add the "has" condition where clause to the query.

protected addHasWhere(Builder $hasQuery, Relation $relation, string $operator, int $count, string $boolean) : Builder|static
Parameters
$hasQuery : Builder
$relation : Relation
$operator : string
$count : int
$boolean : string
Return values
Builder|static

addWhereCountQuery()

Add a sub-query count clause to this query.

protected addWhereCountQuery(Builder $query[, string $operator = '>=' ][, int $count = 1 ][, string $boolean = 'and' ]) : $this
Parameters
$query : Builder
$operator : string = '>='
$count : int = 1
$boolean : string = 'and'
Return values
$this

canUseExistsForExistenceCheck()

Check if we can run an "exists" query to optimize performance.

protected canUseExistsForExistenceCheck(string $operator, int $count) : bool
Parameters
$operator : string
$count : int
Return values
bool

getRelationWithoutConstraints()

Get the "has relation" base query instance.

protected getRelationWithoutConstraints(string $relation) : Relation
Parameters
$relation : string
Return values
Relation

hasNested()

Add nested relationship count / exists conditions to the query.

protected hasNested(string $relations[, string $operator = '>=' ][, int $count = 1 ][, string $boolean = 'and' ][, Closure|null $callback = null ]) : Builder|static

Sets up recursive call to whereHas until we finish the nested relation.

Parameters
$relations : string
$operator : string = '>='
$count : int = 1
$boolean : string = 'and'
$callback : Closure|null = null
Return values
Builder|static

Search results