QueriesRelationships
trait 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) Добавить условие "has" к запросу. | |
| Builder|QueriesRelationships | mergeConstraintsFrom(Builder $from) Объединить условия where из другого запроса в текущий запрос. | |
| $this | addWhereCountQuery(Builder $query, string $operator = '>=', int $count = 1, string $boolean = 'and') Добавить условие подсчёта вложенного запроса в этот запрос. | |
| Relation | getRelationWithoutConstraints(string $relation) Получить базовую instancю запроса для связи "has". | |
| 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.6/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.html