QueriesRelationships
трейт QueriesRelationships (View source)
Методы
| Builder|QueriesRelationships | has(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 | 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-условиями и "или". | |
| $this | withCount(mixed $relations) Добавить подзапросы для подсчета связей. | |
| Builder|QueriesRelationships | addHasWhere(Builder $hasQuery, Relation $relation, string $operator, int $count, string $boolean) Добавить where-условие "has" к запросу. | |
| Builder|QueriesRelationships | mergeConstraintsFrom(Builder $from) Объединить where-условия из другого запроса с текущим запросом. | |
| $this | addWhereCountQuery(Builder $query, string $operator = '>=', int $count = 1, string $boolean = 'and') Добавить подзапрос для подсчета к этому запросу. | |
| Relation | getRelationWithoutConstraints(string $relation) Получить базовый запрос "has relation". | |
| bool | canUseExistsForExistenceCheck(string $operator, int $count) Проверить, можно ли запустить запрос "exists" для оптимизации производительности. |
Подробности
Builder|QueriesRelationships has(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 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 и "или".
$this withCount(mixed $relations)
Добавить подзапросы для подсчёта связей.
protected Builder|QueriesRelationships addHasWhere(Builder $hasQuery, Relation $relation, string $operator, int $count, string $boolean)
Добавить условие "has" к запросу.
Builder|QueriesRelationships mergeConstraintsFrom(Builder $from)
Объединить условия where из другого запроса в текущий запрос.
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/5.5/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.html