Spec-Zone.ru › Laravel 10

ЗапросыRelationships

атрибут ЗапросыRelationships (View source)

Методы

Builder|QueriesRelationships has(Relation|string $relation, string $operator = '>=', int $count = 1, string $boolean = 'and', Closure $callback = null)

Добавить условие подсчёта/существования отношения к запросу.

Builder|QueriesRelationships hasNested(string $relations, string $operator = '>=', int $count = 1, string $boolean = 'and', Closure|null $callback = null)

Добавить условия подсчёта/существования вложенных отношений к запросу.

Builder|QueriesRelationships orHas(string $relation, string $operator = '>=', int $count = 1)

Добавить условие подсчёта/существования отношения к запросу с "или".

Builder|QueriesRelationships doesntHave(string $relation, string $boolean = 'and', Closure $callback = null)

Добавить условие подсчёта/существования отношения к запросу.

Builder|QueriesRelationships orDoesntHave(string $relation)

Добавить условие подсчёта/существования отношения к запросу с "или".

Builder|QueriesRelationships whereHas(string $relation, Closure $callback = null, string $operator = '>=', int $count = 1)

Добавить условие подсчёта/существования отношения к запросу с условиями where.

Builder|QueriesRelationships withWhereHas(string $relation, Closure $callback = null, string $operator = '>=', int $count = 1)

Добавить условие подсчёта/существования отношения к запросу с условиями where.

Builder|QueriesRelationships orWhereHas(string $relation, Closure $callback = null, string $operator = '>=', int $count = 1)

Добавить условие подсчёта/существования отношения к запросу с условиями where и "или".

Builder|QueriesRelationships whereDoesntHave(string $relation, Closure $callback = null)

Добавить условие подсчёта/существования отношения к запросу с условиями where.

Builder|QueriesRelationships orWhereDoesntHave(string $relation, Closure $callback = null)

Добавить условие подсчёта/существования отношения к запросу с условиями where и "или".

Builder|QueriesRelationships hasMorph(MorphTo|string $relation, string|array $types, string $operator = '>=', int $count = 1, string $boolean = 'and', Closure $callback = null)

Добавить условие подсчёта/существования полиморфного отношения к запросу.

BelongsTo getBelongsToRelation(MorphTo $relation, string $type)

Получить отношение BelongsTo для одного полиморфного типа.

Builder|QueriesRelationships orHasMorph(MorphTo|string $relation, string|array $types, string $operator = '>=', int $count = 1)

Добавить условие подсчёта/существования полиморфного отношения к запросу с "или".

Builder|QueriesRelationships doesntHaveMorph(MorphTo|string $relation, string|array $types, string $boolean = 'and', Closure $callback = null)

Добавить условие подсчёта/существования полиморфного отношения к запросу.

Builder|QueriesRelationships orDoesntHaveMorph(MorphTo|string $relation, string|array $types)

Добавить условие подсчёта/существования полиморфного отношения к запросу с "или".

Builder|QueriesRelationships whereHasMorph(MorphTo|string $relation, string|array $types, Closure $callback = null, string $operator = '>=', int $count = 1)

Добавить условие подсчёта/существования полиморфного отношения к запросу с условиями where.

Builder|QueriesRelationships orWhereHasMorph(MorphTo|string $relation, string|array $types, Closure $callback = null, string $operator = '>=', int $count = 1)

Добавить условие подсчёта/существования полиморфного отношения к запросу с условиями where и "или".

Builder|QueriesRelationships whereDoesntHaveMorph(MorphTo|string $relation, string|array $types, Closure $callback = null)

Добавить условие подсчёта/существования полиморфного отношения к запросу с условиями where.

Builder|QueriesRelationships orWhereDoesntHaveMorph(MorphTo|string $relation, string|array $types, Closure $callback = null)

Добавить условие подсчёта/существования полиморфного отношения к запросу с условиями where и "или".

Builder|QueriesRelationships whereRelation(string $relation, Closure|string|array|Expression $column, mixed $operator = null, mixed $value = null)

Добавить базовое условие where к запросу для связи.

Builder|QueriesRelationships orWhereRelation(string $relation, Closure|string|array|Expression $column, mixed $operator = null, mixed $value = null)

Добавить условие "или где" к запросу для связи.

Builder|QueriesRelationships whereMorphRelation(MorphTo|string $relation, string|array $types, Closure|string|array|Expression $column, mixed $operator = null, mixed $value = null)

Добавить полиморфное условие связи к запросу с помощью условия where.

Builder|QueriesRelationships orWhereMorphRelation(MorphTo|string $relation, string|array $types, Closure|string|array|Expression $column, mixed $operator = null, mixed $value = null)

Добавить полиморфное условие связи к запросу с помощью условия "или где".

Builder|QueriesRelationships whereMorphedTo(MorphTo|string $relation, Model|string|null $model, $boolean = 'and')

Добавить условие связи "morph-to" к запросу.

Builder|QueriesRelationships whereNotMorphedTo(MorphTo|string $relation, Model|string $model, $boolean = 'and')

Добавить условие связи "не morph-to" к запросу.

Builder|QueriesRelationships orWhereMorphedTo(MorphTo|string $relation, Model|string|null $model)

Добавить условие связи "morph-to" к запросу с помощью условия "или где".

Builder|QueriesRelationships orWhereNotMorphedTo(MorphTo|string $relation, Model|string $model)

Добавить условие связи "не morph-to" к запросу с помощью условия "или где".

$this whereBelongsTo(Model|Model> $related, string|null $relationshipName = null, string $boolean = 'and')

Добавить условие связи "belongs to" к запросу.

$this orWhereBelongsTo(Model $related, string|null $relationshipName = null)

Добавить условие связи "BelongsTo" с помощью условия "или где" к запросу.

$this withAggregate(mixed $relations, Expression|string $column, string $function = null)

Добавить подзапросы для включения агрегированного значения для связи.

string getRelationHashedColumn(string $column, Relation $relation)

Получить имя хэшированного столбца связи для заданного столбца и связи.

$this withCount(mixed $relations)

Добавить подзапросы для подсчета связей.

$this withMax(string|array $relation, Expression|string $column)

Добавить подзапросы для включения максимального значения столбца связи.

$this withMin(string|array $relation, Expression|string $column)

Добавить подзапросы для включения минимального значения столбца связи.

$this withSum(string|array $relation, Expression|string $column)

Добавить подзапросы для включения суммы значений столбца связи.

$this withAvg(string|array $relation, Expression|string $column)

Добавить подзапросы для включения среднего значения столбца связи.

$this withExists(string|array $relation)

Добавить подзапросы для включения проверки существования связанных моделей.

Builder|QueriesRelationships addHasWhere(Builder $hasQuery, Relation $relation, string $operator, int $count, string $boolean)

Добавить условие "has" к запросу.

Builder|QueriesRelationships mergeConstraintsFrom(Builder $from)

Объединить условия where из другого запроса в текущий запрос.

array requalifyWhereTables(array $wheres, string $from, string $to)

Обновляет имя таблицы для любых столбцов с новым квалифицированным именем.

$this addWhereCountQuery(Builder $query, string $operator = '>=', int $count = 1, string $boolean = 'and')

Добавить условие подзапроса count к этому запросу.

Relation getRelationWithoutConstraints(string $relation)

Получить базовый экземпляр запроса "has relation".

bool canUseExistsForExistenceCheck(string $operator, int $count)

Проверить, можем ли мы выполнить запрос "exists", чтобы оптимизировать производительность.

Подробности

Builder|QueriesRelationships has(Relation|string $relation, string $operator = '>=', int $count = 1, string $boolean = 'and', Closure $callback = null)

Добавить условие подсчета/существования отношения к запросу.

Параметры

Relation|string $relation
string $operator
int $count
string $boolean
Closure $callback

Возвращаемое значение

Builder|QueriesRelationships

Исключения

RuntimeException

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

Добавить условия подсчета/существования вложенных отношений к запросу.

Настраивает рекурсивный вызов whereHas, пока не будут обработаны все вложенные отношения.

Параметры

string $relations
string $operator
int $count
string $boolean
Closure|null $callback

Возвращаемое значение

Builder|QueriesRelationships

Builder|QueriesRelationships orHas(string $relation, string $operator = '>=', int $count = 1)

Добавить условие подсчета/существования отношения к запросу с оператором "или".

Параметры

string $relation
string $operator
int $count

Возвращаемое значение

Builder|QueriesRelationships

Builder|QueriesRelationships doesntHave(string $relation, string $boolean = 'and', Closure $callback = null)

Добавить условие подсчета/отсутствия отношения к запросу.

Параметры

string $relation
string $boolean
Closure $callback

Возвращаемое значение

Builder|QueriesRelationships

Builder|QueriesRelationships orDoesntHave(string $relation)

Добавить условие подсчета/отсутствия отношения к запросу с оператором "или".

Параметры

string $relation

Возвращаемое значение

Builder|QueriesRelationships

Builder|QueriesRelationships whereHas(string $relation, Closure $callback = null, string $operator = '>=', int $count = 1)

Добавить условие подсчета/существования отношения к запросу с условиями where.

Параметры

string $relation
Closure $callback
string $operator
int $count

Возвращаемое значение

Builder|QueriesRelationships

Builder|QueriesRelationships withWhereHas(string $relation, Closure $callback = null, string $operator = '>=', int $count = 1)

Добавить условие подсчета/существования отношения к запросу с условиями where.

Также загрузить отношение с тем же условием.

Параметры

string $relation
Closure $callback
string $operator
int $count

Возвращаемое значение

Builder|QueriesRelationships

Builder|QueriesRelationships orWhereHas(string $relation, Closure $callback = null, string $operator = '>=', int $count = 1)

Добавить условие подсчета/существования отношения к запросу с условиями where и оператором "или".

Параметры

string $relation
Closure $callback
string $operator
int $count

Возвращаемое значение

Builder|QueriesRelationships

Builder|QueriesRelationships whereDoesntHave(string $relation, Closure $callback = null)

Добавить условие подсчета/отсутствия отношения к запросу с условиями where.

Параметры

string $relation
Closure $callback

Возвращаемое значение

Builder|QueriesRelationships
END_OF_DOCUMENT_MARKER

Builder|QueriesRelationships orWhereDoesntHave(string $relation, Closure $callback = null)

Добавить условие подсчета/существования отношения к запросу с условиями where и оператором "или".

Parameters

string $relation
Closure $callback

Return Value

Builder|QueriesRelationships

Builder|QueriesRelationships hasMorph(MorphTo|string $relation, string|array $types, string $operator = '>=', int $count = 1, string $boolean = 'and', Closure $callback = null)

Добавить условие подсчета/существования полиморфного отношения к запросу.

Parameters

MorphTo|string $relation
string|array $types
string $operator
int $count
string $boolean
Closure $callback

Return Value

Builder|QueriesRelationships

protected BelongsTo getBelongsToRelation(MorphTo $relation, string $type)

Получить отношение BelongsTo для одного полиморфного типа.

Parameters

MorphTo $relation
string $type

Return Value

BelongsTo

Builder|QueriesRelationships orHasMorph(MorphTo|string $relation, string|array $types, string $operator = '>=', int $count = 1)

Добавить условие подсчета/существования полиморфного отношения к запросу с оператором "или".

Parameters

MorphTo|string $relation
string|array $types
string $operator
int $count

Return Value

Builder|QueriesRelationships

Builder|QueriesRelationships doesntHaveMorph(MorphTo|string $relation, string|array $types, string $boolean = 'and', Closure $callback = null)

Добавить условие подсчета/существования полиморфного отношения к запросу.

Parameters

MorphTo|string $relation
string|array $types
string $boolean
Closure $callback

Return Value

Builder|QueriesRelationships

Builder|QueriesRelationships orDoesntHaveMorph(MorphTo|string $relation, string|array $types)

Добавить условие подсчета/существования полиморфного отношения к запросу с оператором "или".

Parameters

MorphTo|string $relation
string|array $types

Return Value

Builder|QueriesRelationships

Builder|QueriesRelationships whereHasMorph(MorphTo|string $relation, string|array $types, Closure $callback = null, string $operator = '>=', int $count = 1)

Добавить условие подсчета/существования полиморфного отношения к запросу с условиями where.

Parameters

MorphTo|string $relation
string|array $types
Closure $callback
string $operator
int $count

Return Value

Builder|QueriesRelationships

Builder|QueriesRelationships orWhereHasMorph(MorphTo|string $relation, string|array $types, Closure $callback = null, string $operator = '>=', int $count = 1)

Добавить условие подсчета/существования полиморфного отношения к запросу с условиями where и оператором "или".

Parameters

MorphTo|string $relation
string|array $types
Closure $callback
string $operator
int $count

Return Value

Builder|QueriesRelationships

Builder|QueriesRelationships whereDoesntHaveMorph(MorphTo|string $relation, string|array $types, Closure $callback = null)

Добавить условие подсчета/существования полиморфного отношения к запросу с условиями where.

Parameters

MorphTo|string $relation
string|array $types
Closure $callback

Return Value

Builder|QueriesRelationships

Builder|QueriesRelationships orWhereDoesntHaveMorph(MorphTo|string $relation, string|array $types, Closure $callback = null)

Добавить условие подсчета/существования полиморфного отношения к запросу с условиями where и "or".

Parameters

MorphTo|string $relation
string|array $types
Closure $callback

Return Value

Builder|QueriesRelationships

Builder|QueriesRelationships whereRelation(string $relation, Closure|string|array|Expression $column, mixed $operator = null, mixed $value = null)

Добавить базовое условие where к запросу отношения.

Parameters

string $relation
Closure|string|array|Expression $column
mixed $operator
mixed $value

Return Value

Builder|QueriesRelationships

Builder|QueriesRelationships orWhereRelation(string $relation, Closure|string|array|Expression $column, mixed $operator = null, mixed $value = null)

Добавить условие "or where" к запросу отношения.

Parameters

string $relation
Closure|string|array|Expression $column
mixed $operator
mixed $value

Return Value

Builder|QueriesRelationships

Builder|QueriesRelationships whereMorphRelation(MorphTo|string $relation, string|array $types, Closure|string|array|Expression $column, mixed $operator = null, mixed $value = null)

Добавить условие полиморфного отношения к запросу с условием where.

Parameters

MorphTo|string $relation
string|array $types
Closure|string|array|Expression $column
mixed $operator
mixed $value

Return Value

Builder|QueriesRelationships

Builder|QueriesRelationships orWhereMorphRelation(MorphTo|string $relation, string|array $types, Closure|string|array|Expression $column, mixed $operator = null, mixed $value = null)

Добавить условие полиморфного отношения к запросу с условием "or where".

Parameters

MorphTo|string $relation
string|array $types
Closure|string|array|Expression $column
mixed $operator
mixed $value

Return Value

Builder|QueriesRelationships

Builder|QueriesRelationships whereMorphedTo(MorphTo|string $relation, Model|string|null $model, $boolean = 'and')

Добавить условие отношения morph-to к запросу.

Parameters

MorphTo|string $relation
Model|string|null $model
$boolean

Return Value

Builder|QueriesRelationships
END_OF_DOCUMENT_MARKER

Builder|QueriesRelationships whereNotMorphedTo(MorphTo|string $relation, Model|string $model, $boolean = 'and')

Добавить условие не-отношения морфинг к запросу.

Параметры

MorphTo|string $relation
Model|string $model
$boolean

Возвращаемое значение

Builder|QueriesRelationships

Builder|QueriesRelationships orWhereMorphedTo(MorphTo|string $relation, Model|string|null $model)

Добавить условие отношения морфинг к запросу с "или где" условием.

Параметры

MorphTo|string $relation
Model|string|null $model

Возвращаемое значение

Builder|QueriesRelationships

Builder|QueriesRelationships orWhereNotMorphedTo(MorphTo|string $relation, Model|string $model)

Добавить условие не-отношения морфинг к запросу с "или где" условием.

Параметры

MorphTo|string $relation
Model|string $model

Возвращаемое значение

Builder|QueriesRelationships

$this whereBelongsTo(Model|Model> $related, string|null $relationshipName = null, string $boolean = 'and')

Добавить условие отношения "принадлежит" к запросу.

Параметры

Model|Model> $related
string|null $relationshipName
string $boolean

Возвращаемое значение

$this

Исключения

RelationNotFoundException

$this orWhereBelongsTo(Model $related, string|null $relationshipName = null)

Добавить условие отношения "Принадлежит" с "или где" условием к запросу.

Параметры

Model $related
string|null $relationshipName

Возвращаемое значение

$this

Исключения

RuntimeException

$this withAggregate(mixed $relations, Expression|string $column, string $function = null)

Добавить подзапросы для включения агрегированного значения для отношения.

Параметры

mixed $relations
Expression|string $column
string $function

Возвращаемое значение

$this

protected string getRelationHashedColumn(string $column, Relation $relation)

Получить имя хешированного столбца отношения для данного столбца и отношения.

Параметры

string $column
Relation $relation

Возвращаемое значение

string

$this withCount(mixed $relations)

Добавить подзапросы для подсчета отношений.

Параметры

mixed $relations

Возвращаемое значение

$this

$this withMax(string|array $relation, Expression|string $column)

Добавить подзапросы для включения максимального значения столбца отношения.

Параметры

string|array $relation
Expression|string $column

Возвращаемое значение

$this

$this withMin(string|array $relation, Expression|string $column)

Добавить подзапросы для включения минимального значения столбца отношения.

Параметры

string|array $relation
Expression|string $column

Возвращаемое значение

$this

$this withSum(string|array $relation, Expression|string $column)

Добавить подзапросы для включения суммы значений столбца отношения.

Параметры

string|array $relation
Expression|string $column

Возвращаемое значение

$this

$this withAvg(string|array $relation, Expression|string $column)

Добавить подзапросы для включения среднего значения столбца отношения.

Параметры

string|array $relation
Expression|string $column

Возвращаемое значение

$this

$this withExists(string|array $relation)

Добавить подзапросы, чтобы включить проверку существования связанных моделей.

Параметры

string|array $relation

Возвращаемое значение

$this

protected Builder|QueriesRelationships addHasWhere(Builder $hasQuery, Relation $relation, string $operator, int $count, string $boolean)

Добавить условие «has» в предложение where запроса.

Параметры

Builder $hasQuery
Relation $relation
string $operator
int $count
string $boolean

Возвращаемое значение

Builder|QueriesRelationships

Builder|QueriesRelationships mergeConstraintsFrom(Builder $from)

Объединить условия where из другого запроса в текущий запрос.

Параметры

Builder $from

Возвращаемое значение

Builder|QueriesRelationships

protected array requalifyWhereTables(array $wheres, string $from, string $to)

Обновляет имя таблицы для любых столбцов с новым квалифицированным именем.

Параметры

array $wheres
string $from
string $to

Возвращаемое значение

array

protected $this addWhereCountQuery(Builder $query, string $operator = '>=', int $count = 1, string $boolean = 'and')

Добавить условие подсчета с помощью подзапроса в этот запрос.

Параметры

Builder $query
string $operator
int $count
string $boolean

Возвращаемое значение

$this

protected Relation getRelationWithoutConstraints(string $relation)

Получить экземпляр базового запроса «has relation».

Параметры

string $relation

Возвращаемое значение

Relation

protected bool canUseExistsForExistenceCheck(string $operator, int $count)

Проверить, можно ли использовать запрос «exists» для оптимизации производительности.

Параметры

string $operator
int $count

Возвращаемое значение

bool

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/10.x/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API