Запросы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)
Добавить условие подсчета/существования отношения к запросу.
protected Builder|QueriesRelationships hasNested(string $relations, string $operator = '>=', int $count = 1, string $boolean = 'and', Closure|null $callback = null)
Добавить условия подсчета/существования вложенных отношений к запросу.
Настраивает рекурсивный вызов whereHas, пока не будут обработаны все вложенные отношения.
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)
Добавить условие подсчета/существования полиморфного отношения к запросу.
protected 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 и "or".
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)
Добавить условие "or where" к запросу отношения.
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)
Добавить условие полиморфного отношения к запросу с условием "or where".
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')
Добавить условие не-отношения морфинг к запросу.
Builder|QueriesRelationships orWhereMorphedTo(MorphTo|string $relation, Model|string|null $model)
Добавить условие отношения морфинг к запросу с "или где" условием.
Builder|QueriesRelationships orWhereNotMorphedTo(MorphTo|string $relation, Model|string $model)
Добавить условие не-отношения морфинг к запросу с "или где" условием.
$this whereBelongsTo(Model|Model> $related, string|null $relationshipName = null, string $boolean = 'and')
Добавить условие отношения "принадлежит" к запросу.
$this orWhereBelongsTo(Model $related, string|null $relationshipName = null)
Добавить условие отношения "Принадлежит" с "или где" условием к запросу.
$this withAggregate(mixed $relations, Expression|string $column, string $function = null)
Добавить подзапросы для включения агрегированного значения для отношения.
protected 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)
Добавить подзапросы, чтобы включить проверку существования связанных моделей.
protected Builder|QueriesRelationships addHasWhere(Builder $hasQuery, Relation $relation, string $operator, int $count, string $boolean)
Добавить условие «has» в предложение where запроса.
Builder|QueriesRelationships mergeConstraintsFrom(Builder $from)
Объединить условия where из другого запроса в текущий запрос.
protected array requalifyWhereTables(array $wheres, string $from, string $to)
Обновляет имя таблицы для любых столбцов с новым квалифицированным именем.
protected $this addWhereCountQuery(Builder $query, string $operator = '>=', int $count = 1, string $boolean = 'and')
Добавить условие подсчета с помощью подзапроса в этот запрос.
protected Relation getRelationWithoutConstraints(string $relation)
Получить экземпляр базового запроса «has relation».
protected bool canUseExistsForExistenceCheck(string $operator, int $count)
Проверить, можно ли использовать запрос «exists» для оптимизации производительности.
© 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