Spec-Zone.ru › Laravel 11

JoinClause

class JoinClause extends Builder (View source)

Свойства

BuildsQueries
ExplainsQueries
ForwardsCalls
Macroable
Conditionable

Свойства

static protected array $macros

Зарегистрированные строковые макросы.

from Macroable
ConnectionInterface $connection

Экземпляр подключения к базе данных.

from Builder
Grammar $grammar

Экземпляр синтаксического анализатора запросов к базе данных.

from Builder
Processor $processor

Экземпляр постпроцессора запросов к базе данных.

from Builder
array $bindings

Текущие значения связей запроса.

from Builder
array $aggregate

Функция агрегирования и столбец для выполнения.

from Builder
array|null $columns

Столбцы, которые должны быть возвращены.

from Builder
bool|array $distinct

Указывает, возвращает ли запрос уникальные результаты.

from Builder
Expression|string $from

Таблица, на которую нацелен запрос.

from Builder
IndexHint $indexHint

Указание индекса для запроса.

from Builder
array $joins

Соединения таблиц для запроса.

from Builder
array $wheres

Условие where для запроса.

from Builder
array $groups

Группировки для запроса.

from Builder
array $havings

Условие having для запроса.

from Builder
array $orders

Порядок сортировки для запроса.

from Builder
int $limit

Максимальное количество записей для возврата.

from Builder
array $groupLimit

Максимальное количество записей для возврата на группу.

from Builder
int $offset

Количество записей, которые следует пропустить.

from Builder
array $unions

Запросы объединенных операторов.

from Builder
int $unionLimit

Максимальное количество объединенных записей для возврата.

from Builder
int $unionOffset

Количество записей объединения, которое нужно пропустить.

из Builder
array $unionOrders

Порядок сортировки для запроса объединения.

из Builder
string|bool $lock

Указывает, используется ли блокировка строк.

из Builder
array $beforeQueryCallbacks

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

из Builder
protected array $afterQueryCallbacks

Обработчики, которые должны быть вызваны после получения данных из базы данных.

из Builder
string[] $operators

Все доступные операторы для условий.

из Builder
string[] $bitwiseOperators

Все доступные побитовые операторы.

из Builder
bool $useWritePdo

Использовать ли write pdo для выборки.

из Builder
string $type

Тип соединения, выполняемого.

string $table

Таблица, к которой подключается условие соединения.

protected ConnectionInterface $parentConnection

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

protected Grammar $parentGrammar

Грамматика родительского билдера запросов.

protected Processor $parentProcessor

Обработчик родительского билдера запросов.

protected string $parentClass

Имя класса родительского билдера запросов.

Методы

$this|TWhenReturnType when($value = null, callable|null $callback = null, callable|null $default = null)

Примените обратный вызов, если заданное «значение» является (или разрешается в) истинное значение.

из Conditionable
$this|TUnlessReturnType unless($value = null, callable|null $callback = null, callable|null $default = null)

Примените обратный вызов, если заданное «значение» является (или разрешается в) ложное значение.

из Conditionable
bool chunk(int $count, callable $callback)

Разбить результаты запроса на куски.

из BuildsQueries
TReturn> chunkMap(callable $callback, int $count = 1000)

Выполнить отображение над каждым элементом с разбивкой на куски.

из BuildsQueries
bool each(callable $callback, int $count = 1000)

Выполнить обратный вызов над каждым элементом с разбивкой на куски.

из BuildsQueries
bool chunkById(int $count, callable $callback, string|null $column = null, string|null $alias = null)

Разбить результаты запроса на куски, сравнивая идентификаторы.

из BuildsQueries
bool chunkByIdDesc(int $count, callable $callback, string|null $column = null, string|null $alias = null)

Разбить результаты запроса на куски, сравнивая идентификаторы в порядке убывания.

из BuildsQueries
bool orderedChunkById(int $count, callable $callback, string|null $column = null, string|null $alias = null, bool $descending = false)

Разбить результаты запроса на куски, сравнивая идентификаторы в заданном порядке.

из BuildsQueries
bool eachById(callable $callback, int $count = 1000, string|null $column = null, string|null $alias = null)

Выполнить обратный вызов над каждым элементом с разбивкой на куски по идентификатору.

из BuildsQueries
LazyCollection lazy(int $chunkSize = 1000)

Выполнить запрос лениво, по кускам заданного размера.

из BuildsQueries
LazyCollection lazyById(int $chunkSize = 1000, string|null $column = null, string|null $alias = null)

Выполнить запрос лениво, разбивая результаты запроса на куски, сравнивая идентификаторы.

из BuildsQueries
LazyCollection lazyByIdDesc(int $chunkSize = 1000, string|null $column = null, string|null $alias = null)

Выполнить запрос лениво, разбивая результаты запроса на куски, сравнивая идентификаторы в порядке убывания.

из BuildsQueries
LazyCollection orderedLazyById(int $chunkSize = 1000, string|null $column = null, string|null $alias = null, bool $descending = false)

Лениво выполняет запрос, разбивая результаты на куски для сравнения идентификаторов в заданном порядке.

from BuildsQueries
TValue|null first(array|string $columns = ['*'])

Выполняет запрос и возвращает первый результат.

from BuildsQueries
TValue sole(array|string $columns = ['*'])

Выполняет запрос и возвращает первый результат, если это единственная совпадающая запись.

from BuildsQueries
CursorPaginator paginateUsingCursor(int $perPage, array|string $columns = ['*'], string $cursorName = 'cursor', Cursor|string|null $cursor = null)

Выполняет пагинацию заданного запроса с помощью пагинатора курсора.

from BuildsQueries
string getOriginalColumnNameForCursorPagination($builder, string $parameter)

Возвращает исходное имя столбца для данного столбца без каких-либо псевдонимов.

from BuildsQueries
LengthAwarePaginator paginator(Collection $items, int $total, int $perPage, int $currentPage, array $options)

Создаёт новый экземпляр пагинатора с учётом длины.

from BuildsQueries
Paginator simplePaginator(Collection $items, int $perPage, int $currentPage, array $options)

Создаёт новый простой экземпляр пагинатора.

from BuildsQueries
CursorPaginator cursorPaginator(Collection $items, int $perPage, Cursor $cursor, array $options)

Создаёт новый экземпляр пагинатора курсора.

from BuildsQueries
$this tap($callback)

Передаёт запрос в заданный обратный вызов.

from BuildsQueries
Collection explain()

Объясняет запрос.

from ExplainsQueries
mixed forwardCallTo(mixed $object, string $method, array $parameters)

Перенаправляет вызов метода на заданный объект.

from ForwardsCalls
mixed forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Передать вызов метода заданному объекту, вернув $this, если переданный вызов вернул себя.

из ForwardsCalls
static void throwBadMethodCallException(string $method)

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

из ForwardsCalls
static void macro(string $name, object|callable $macro)

Зарегистрировать пользовательский макрос.

из Macroable
static void mixin(object $mixin, bool $replace = true)

Смешать другой объект в класс.

из Macroable
static bool hasMacro(string $name)

Проверяет, зарегистрирован ли макрос.

из Macroable
static void flushMacros()

Очистить существующие макросы.

из Macroable
static mixed __callStatic(string $method, array $parameters)

Динамически обработать вызовы класса.

из Macroable
mixed __call(string $method, array $parameters)

Динамически обработать вызовы класса.

из Macroable
void __construct(Builder $parentQuery, string $type, string $table)

Создать новый экземпляр условия объединения.

$this select(array|mixed $columns = ['*'])

Установить столбцы для выбора.

из Builder
$this selectSub($query, string $as)

Добавить выражение подзапроса в запрос.

из Builder
$this selectRaw(string $expression, array $bindings = [])

Добавить новое выражение "сырого" выбора в запрос.

из Builder
$this fromSub($query, string $as)

Выполняет "from" для получения данных из подзапроса.

из Builder
$this fromRaw(string $expression, mixed $bindings = [])

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

из Builder
array createSub($query)

Создаёт подзапрос и парсит его.

из Builder
array parseSub(mixed $query)

Парсит подзапрос в SQL и параметры.

из Builder
mixed prependDatabaseNameIfCrossDatabaseQuery(mixed $query)

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

from Builder
$this addSelect(array|mixed $column)

Добавить новый столбец выбора в запрос.

from Builder
$this distinct()

Принудительно вернуть только уникальные результаты.

from Builder
$this from($table, string|null $as = null)

Установить таблицу, на которую направлен запрос.

from Builder
$this useIndex(string $index)

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

from Builder
$this forceIndex(string $index)

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

from Builder
$this ignoreIndex(string $index)

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

from Builder
$this join(Expression|string $table, Closure|Expression|string $first, string|null $operator = null, Expression|string|null $second = null, string $type = 'inner', bool $where = false)

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

from Builder
$this joinWhere(Expression|string $table, Closure|Expression|string $first, string $operator, Expression|string $second, string $type = 'inner')

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

from Builder
$this joinSub($query, string $as, Closure|Expression|string $first, string|null $operator = null, Expression|string|null $second = null, string $type = 'inner', bool $where = false)

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

from Builder
$this joinLateral($query, string $as, string $type = 'inner')

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

from Builder
$this leftJoinLateral($query, string $as)

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

from Builder
$this leftJoin(Expression|string $table, Closure|Expression|string $first, string|null $operator = null, Expression|string|null $second = null)

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

из Builder
$this leftJoinWhere(Expression|string $table, Closure|Expression|string $first, string $operator, Expression|string|null $second)

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

из Builder
$this leftJoinSub($query, string $as, Closure|Expression|string $first, string|null $operator = null, Expression|string|null $second = null)

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

из Builder
$this rightJoin(Expression|string $table, Closure|string $first, string|null $operator = null, Expression|string|null $second = null)

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

из Builder
$this rightJoinWhere(Expression|string $table, Closure|Expression|string $first, string $operator, Expression|string $second)

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

из Builder
$this rightJoinSub($query, string $as, Closure|Expression|string $first, string|null $operator = null, Expression|string|null $second = null)

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

из Builder
$this crossJoin(Expression|string $table, Closure|Expression|string|null $first = null, string|null $operator = null, Expression|string|null $second = null)

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

из Builder
$this crossJoinSub($query, string $as)

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

из Builder
JoinClause newJoinClause(Builder $parentQuery, string $type, string $table)

Получить новый фрагмент условия соединения.

из Builder
JoinLateralClause newJoinLateralClause(Builder $parentQuery, string $type, string $table)

Получить новый фрагмент условия соединения по LATERAL.

из Builder
$this mergeWheres(array $wheres, array $bindings)

Объединить массив условий WHERE и связанные с ними значения.

из Builder
$this where(Closure|string|array|Expression $column, mixed $operator = null, mixed $value = null, string $boolean = 'and')

Добавить основное условие WHERE в запрос.

из Builder
$this addArrayOfWheres(array $column, string $boolean, string $method = 'where')

Добавить массив условий WHERE в запрос.

из Builder
array prepareValueAndOperator(string $value, string $operator, bool $useDefault = false)

Подготовить значение и оператор для условия WHERE.

из Builder
bool invalidOperatorAndValue(string $operator, mixed $value)

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

из Builder
bool invalidOperator(string $operator)

Определить, поддерживается ли данный оператор.

из Builder
bool isBitwiseOperator(string $operator)

Определить, является ли оператор побитовым.

из Builder
$this orWhere(Closure|string|array|Expression $column, mixed $operator = null, mixed $value = null)

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

из Builder
$this whereNot(Closure|string|array|Expression $column, mixed $operator = null, mixed $value = null, string $boolean = 'and')

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

из Builder
$this orWhereNot(Closure|string|array|Expression $column, mixed $operator = null, mixed $value = null)

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

из Builder
$this whereColumn(Expression|string|array $first, string|null $operator = null, string|null $second = null, string|null $boolean = 'and')

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

из Builder
$this orWhereColumn(Expression|string|array $first, string|null $operator = null, string|null $second = null)

Добавить условие «or where» для сравнения двух столбцов в запрос.

из Builder
$this whereRaw(string $sql, mixed $bindings = [], string $boolean = 'and')

Добавить сырое условие «where» в запрос.

из Builder
$this orWhereRaw(string $sql, mixed $bindings = [])

Добавить сырое условие «or where» в запрос.

из Builder
$this whereIn(Expression|string $column, mixed $values, string $boolean = 'and', bool $not = false)

Добавить условие «where in» в запрос.

из Builder
$this orWhereIn(Expression|string $column, mixed $values)

Добавить условие «or where in» в запрос.

из Builder
$this whereNotIn(Expression|string $column, mixed $values, string $boolean = 'and')

Добавить условие «where not in» в запрос.

из Builder
$this orWhereNotIn(Expression|string $column, mixed $values)

Добавить условие «or where not in» в запрос.

из Builder
$this whereIntegerInRaw(string $column, Arrayable|array $values, string $boolean = 'and', bool $not = false)

Добавить условие «where in raw» для целочисленных значений в запрос.

из Builder
$this orWhereIntegerInRaw(string $column, Arrayable|array $values)

Добавить условие «or where in raw» для целочисленных значений в запрос.

из Builder
$this whereIntegerNotInRaw(string $column, Arrayable|array $values, string $boolean = 'and')

Добавить условие «where not in raw» для целочисленных значений в запрос.

из Builder
$this orWhereIntegerNotInRaw(string $column, Arrayable|array $values)

Добавить условие «or where not in raw» для целочисленных значений в запрос.

из Builder
$this whereNull(string|array|Expression $columns, string $boolean = 'and', bool $not = false)

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

из Builder
$this orWhereNull(string|array|Expression $column)

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

из Builder
$this whereNotNull(string|array|Expression $columns, string $boolean = 'and')

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

из Builder
$this whereBetween(Expression|string $column, iterable $values, string $boolean = 'and', bool $not = false)

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

из Builder
$this whereBetweenColumns(Expression|string $column, array $values, string $boolean = 'and', bool $not = false)

Добавить условие «между» используя столбцы к запросу.

из Builder
$this orWhereBetween(Expression|string $column, iterable $values)

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

из Builder
$this orWhereBetweenColumns(Expression|string $column, array $values)

Добавить условие «или между» используя столбцы к запросу.

из Builder
$this whereNotBetween(Expression|string $column, iterable $values, string $boolean = 'and')

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

из Builder
$this whereNotBetweenColumns(Expression|string $column, array $values, string $boolean = 'and')

Добавить условие «не между» используя столбцы к запросу.

из Builder
$this orWhereNotBetween(Expression|string $column, iterable $values)

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

из Builder
$this orWhereNotBetweenColumns(Expression|string $column, array $values)

Добавить условие «или не между» используя столбцы к запросу.

из Builder
$this orWhereNotNull(Expression|string $column)

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

из Builder
$this whereDate(Expression|string $column, DateTimeInterface|string|null $operator, DateTimeInterface|string|null $value = null, string $boolean = 'and')

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

из Builder
$this orWhereDate(Expression|string $column, DateTimeInterface|string|null $operator, DateTimeInterface|string|null $value = null)

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

из Builder
$this whereTime(Expression|string $column, DateTimeInterface|string|null $operator, DateTimeInterface|string|null $value = null, string $boolean = 'and')

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

из Builder
$this orWhereTime(Expression|string $column, DateTimeInterface|string|null $operator, DateTimeInterface|string|null $value = null)

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

из Builder
$this whereDay(Expression|string $column, DateTimeInterface|string|int|null $operator, DateTimeInterface|string|int|null $value = null, string $boolean = 'and')

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

из Builder
$this orWhereDay(Expression|string $column, DateTimeInterface|string|int|null $operator, DateTimeInterface|string|int|null $value = null)

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

из Builder
$this whereMonth(Expression|string $column, DateTimeInterface|string|int|null $operator, DateTimeInterface|string|int|null $value = null, string $boolean = 'and')

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

из Builder
$this orWhereMonth(Expression|string $column, DateTimeInterface|string|int|null $operator, DateTimeInterface|string|int|null $value = null)

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

из Builder
$this whereYear(Expression|string $column, DateTimeInterface|string|int|null $operator, DateTimeInterface|string|int|null $value = null, string $boolean = 'and')

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

из Builder
$this orWhereYear(Expression|string $column, DateTimeInterface|string|int|null $operator, DateTimeInterface|string|int|null $value = null)

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

из Builder
$this addDateBasedWhere(string $type, Expression|string $column, string $operator, mixed $value, string $boolean = 'and')

Добавить условие, основанное на дате (год, месяц, день, время), к запросу.

из Builder
$this whereNested(Closure $callback, string $boolean = 'and')

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

из Builder
Builder forNestedWhere()

Создать новый экземпляр запроса для вложенного условия "где".

из Builder
$this addNestedWhereQuery(Builder $query, string $boolean = 'and')

Добавить другой экземпляр Query Builder в качестве вложенного условия "где" к Query Builder.

из Builder
$this whereSub(Expression|string $column, string $operator, $callback, string $boolean)

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

из Builder
$this whereExists($callback, string $boolean = 'and', bool $not = false)

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

из Builder
$this orWhereExists($callback, bool $not = false)

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

из Builder
$this whereNotExists($callback, string $boolean = 'and')

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

из Builder
$this orWhereNotExists($callback)

Добавить условие «where not exists» к запросу.

из Builder
$this addWhereExistsQuery(Builder $query, string $boolean = 'and', bool $not = false)

Добавить условие «exists» к запросу.

из Builder
$this whereRowValues(array $columns, string $operator, array $values, string $boolean = 'and')

Добавить условие «where» с использованием значений строк.

из Builder
$this orWhereRowValues(array $columns, string $operator, array $values)

Добавить условие «or where» с использованием значений строк.

из Builder
$this whereJsonContains(string $column, mixed $value, string $boolean = 'and', bool $not = false)

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

из Builder
$this orWhereJsonContains(string $column, mixed $value)

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

из Builder
$this whereJsonDoesntContain(string $column, mixed $value, string $boolean = 'and')

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

из Builder
$this orWhereJsonDoesntContain(string $column, mixed $value)

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

из Builder
$this whereJsonOverlaps(string $column, mixed $value, string $boolean = 'and', bool $not = false)

Добавить условие «where JSON перекрывается» к запросу.

из Builder
$this orWhereJsonOverlaps(string $column, mixed $value)

Добавить условие «or where JSON перекрывается» к запросу.

из Builder
$this whereJsonDoesntOverlap(string $column, mixed $value, string $boolean = 'and')

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

из Builder
$this orWhereJsonDoesntOverlap(string $column, mixed $value)

Добавить условие «or where JSON не перекрывается» к запросу.

из Builder
$this whereJsonContainsKey(string $column, string $boolean = 'and', bool $not = false)

Добавить условие, определяющее существование JSON-пути, к запросу.

из Builder
$this orWhereJsonContainsKey(string $column)

Добавить условие «or», определяющее существование JSON-пути, к запросу.

из Builder
$this whereJsonDoesntContainKey(string $column, string $boolean = 'and')

Добавить условие, определяющее, существует ли JSON-путь в запросе.

из Builder
$this orWhereJsonDoesntContainKey(string $column)

Добавить условие "или", определяющее, существует ли JSON-путь в запросе.

из Builder
$this whereJsonLength(string $column, mixed $operator, mixed $value = null, string $boolean = 'and')

Добавить условие "длина JSON" в запрос.

из Builder
$this orWhereJsonLength(string $column, mixed $operator, mixed $value = null)

Добавить условие "или длина JSON" в запрос.

из Builder
$this dynamicWhere(string $method, array $parameters)

Обрабатывает динамические условия "where" в запросе.

из Builder
void addDynamic(string $segment, string $connector, array $parameters, int $index)

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

из Builder
$this whereFullText(string|string[] $columns, string $value, array $options = [], string $boolean = 'and')

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

из Builder
$this orWhereFullText(string|string[] $columns, string $value, array $options = [])

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

из Builder
$this whereAll(string[] $columns, mixed $operator = null, mixed $value = null, string $boolean = 'and')

Добавить условие "where" в запрос для нескольких столбцов с условиями "and" между ними.

из Builder
$this orWhereAll(string[] $columns, string $operator = null, mixed $value = null)

Добавить условие "или where" в запрос для нескольких столбцов с условиями "and" между ними.

из Builder
$this whereAny(string[] $columns, string $operator = null, mixed $value = null, string $boolean = 'and')

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

из Builder
$this orWhereAny(string[] $columns, string $operator = null, mixed $value = null)

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

из Builder
$this groupBy(array|Expression|string ...$groups)

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

из Builder
$this groupByRaw(string $sql, array $bindings = [])

Добавить сырое условие groupBy в запрос.

из Builder
$this having(Expression|Closure|string $column, string|int|float|null $operator = null, string|int|float|null $value = null, string $boolean = 'and')

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

из Builder
$this orHaving(Expression|Closure|string $column, string|int|float|null $operator = null, string|int|float|null $value = null)

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

из Builder
$this havingNested(Closure $callback, string $boolean = 'and')

Добавить вложенное условие having к запросу.

из Builder
$this addNestedHavingQuery(Builder $query, string $boolean = 'and')

Добавить другой объект Query Builder в качестве вложенного having к объекту Query Builder.

из Builder
$this havingNull(string|array $columns, string $boolean = 'and', bool $not = false)

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

из Builder
$this orHavingNull(string $column)

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

из Builder
$this havingNotNull(string|array $columns, string $boolean = 'and')

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

из Builder
$this orHavingNotNull(string $column)

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

из Builder
$this havingBetween(string $column, iterable $values, string $boolean = 'and', bool $not = false)

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

из Builder
$this havingRaw(string $sql, array $bindings = [], string $boolean = 'and')

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

из Builder
$this orHavingRaw(string $sql, array $bindings = [])

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

из Builder
$this orderBy($column, string $direction = 'asc')

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

из Builder
$this orderByDesc($column)

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

из Builder
$this latest(Closure|Builder|Expression|string $column = 'created_at')

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

from Builder
$this oldest(Closure|Builder|Expression|string $column = 'created_at')

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

from Builder
$this inRandomOrder(string|int $seed = '')

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

from Builder
$this orderByRaw(string $sql, array $bindings = [])

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

from Builder
$this skip(int $value)

Псевдоним для установки значения "смещение" запроса.

from Builder
$this offset(int $value)

Установить значение "смещения" запроса.

from Builder
$this take(int $value)

Псевдоним для установки значения "лимит" запроса.

from Builder
$this limit(int $value)

Установить значение "лимита" запроса.

from Builder
$this groupLimit(int $value, string $column)

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

from Builder
$this forPage(int $page, int $perPage = 15)

Установить лимит и смещение для заданной страницы.

from Builder
$this forPageBeforeId(int $perPage = 15, int|null $lastId = 0, string $column = 'id')

Ограничить запрос предыдущей "страницей" результатов перед заданным идентификатором.

from Builder
$this forPageAfterId(int $perPage = 15, int|null $lastId = 0, string $column = 'id')

Ограничить запрос следующей "страницей" результатов после заданного идентификатора.

from Builder
$this reorder(Closure|Builder|Expression|string|null $column = null, string $direction = 'asc')

Удалить все существующие упорядочения и, при необходимости, добавить новое упорядочение.

from Builder
array removeExistingOrdersFor(string $column)

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

from Builder
$this union($query, bool $all = false)

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

из Builder
$this unionAll($query)

Добавить оператор объединения all к запросу.

из Builder
$this lock(string|bool $value = true)

Заблокировать выбранные строки в таблице.

из Builder
$this lockForUpdate()

Заблокировать выбранные строки в таблице для обновления.

из Builder
$this sharedLock()

Заблокировать выбранные строки в таблице совместно.

из Builder
$this beforeQuery(callable $callback)

Зарегистрировать замыкание, которое будет вызываться перед выполнением запроса.

из Builder
void applyBeforeQueryCallbacks()

Вызвать обратные вызовы модификации «перед запросом».

из Builder
$this afterQuery(Closure $callback)

Зарегистрировать замыкание, которое будет вызываться после выполнения запроса.

из Builder
mixed applyAfterQueryCallbacks(mixed $result)

Вызвать обратные вызовы модификации «после запроса».

из Builder
string toSql()

Получить SQL-представление запроса.

из Builder
string toRawSql()

Получить необработанное SQL-представление запроса со встроенными связываниями.

из Builder
object|null find(int|string $id, array|string $columns = ['*'])

Выполнить запрос для одной записи по идентификатору.

из Builder
findOr($id, $columns = ['*'], Closure|null $callback = null)

Без описания

из Builder
mixed value(string $column)

Получить значение одного столбца из первого результата запроса.

из Builder
mixed rawValue(string $expression, array $bindings = [])

Получить значение одного выражения из первого результата запроса.

из Builder
mixed soleValue(string $column)

Получить значение одного столбца из первого результата запроса, если это единственная соответствующая запись.

из Builder
Коллекция get(array|string $columns = ['*'])

Выполнить запрос как оператор «select».

из Строителя
массив runSelect()

Выполнить запрос как оператор «select» для соединения.

из Строителя
Коллекция withoutGroupLimitKeys(Коллекция $items)

Удалить ключи ограничения группировки из результатов в коллекции.

из Строителя
Paginator со знанием длины paginate(int|Closure $perPage = 15, array|string $columns = ['*'], string $pageName = 'page', int|null $page = null, Closure|int|null $total = null)

Разбить заданный запрос на страницы с помощью простого пагинатора.

из Строителя
Paginator simplePaginate(int $perPage = 15, array|string $columns = ['*'], string $pageName = 'page', int|null $page = null)

Получить пагинатор, поддерживающий только простые ссылки «следующая» и «предыдущая».

из Строителя
CursorPaginator cursorPaginate(int|null $perPage = 15, array|string $columns = ['*'], string $cursorName = 'cursor', Cursor|string|null $cursor = null)

Получить пагинатор, поддерживающий только простые ссылки «следующая» и «предыдущая».

из Строителя
Коллекция ensureOrderForCursorPagination(bool $shouldReverse = false)

Обеспечить правильный порядок, необходимый для пагинации по курсорам.

из Строителя
целое число getCountForPagination(array $columns = ['*'])

Получить количество всех записей для пагинатора.

из Строителя
массив runPaginationCountQuery(array $columns = ['*'])

Выполнить запрос для подсчета страниц.

из Строителя
Строитель cloneForPaginationCount()

Клонировать существующий экземпляр запроса для использования в подзапросе пагинации.

из Строителя
массив withoutSelectAliases(array $columns)

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

из Строителя
Ленивая коллекция cursor()

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

из Строителя
void enforceOrderBy()

Выбросить исключение, если в запросе нет предложения orderBy.

из Builder
Collection<array-key,mixed> pluck(Expression|string $column, string|null $key = null)

Получить экземпляр коллекции, содержащий значения заданного столбца.

из Builder
string|null stripTableForPluck(string $column)

Удалить имя или псевдоним таблицы из идентификатора столбца.

из Builder
Collection pluckFromObjectColumn(array $queryResult, string $column, string $key)

Извлечь значения столбцов из строк, представленных как объекты.

из Builder
Collection pluckFromArrayColumn(array $queryResult, string $column, string $key)

Извлечь значения столбцов из строк, представленных как массивы.

из Builder
string implode(string $column, string $glue = '')

Сконкатенировать значения заданного столбца в строку.

из Builder
bool exists()

Определить, существуют ли какие-либо строки для текущего запроса.

из Builder
bool doesntExist()

Определить, не существуют ли какие-либо строки для текущего запроса.

из Builder
mixed existsOr(Closure $callback)

Выполнить заданный обратный вызов, если для текущего запроса нет строк.

из Builder
mixed doesntExistOr(Closure $callback)

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

из Builder
int count(Expression|string $columns = '*')

Получить результат "count" запроса.

из Builder
mixed min(Expression|string $column)

Получить минимальное значение заданного столбца.

из Builder
mixed max(Expression|string $column)

Получить максимальное значение заданного столбца.

из Builder
mixed sum(Expression|string $column)

Получить сумму значений заданного столбца.

из Builder
смешанный avg(Expression|строка $column)

Получить среднее значение заданного столбца.

из Builder
смешанный average(Expression|строка $column)

Псевдоним для метода "avg".

из Builder
смешанный aggregate(строка $function, массив $columns = ['*'])

Выполнить агрегатную функцию в базе данных.

из Builder
число с плавающей точкой|целое numericAggregate(строка $function, массив $columns = ['*'])

Выполнить числовую агрегатную функцию в базе данных.

из Builder
$this setAggregate(строка $function, массив $columns)

Установить свойство агрегирования без выполнения запроса.

из Builder
смешанный onceWithColumns(массив $columns, вызов $callback)

Выполнить заданный вызов, выбирая заданные столбцы.

из Builder
булево insert(массив $values)

Вставить новые записи в базу данных.

из Builder
целое insertOrIgnore(массив $values)

Вставить новые записи в базу данных, игнорируя ошибки.

из Builder
целое insertGetId(массив $values, строка|null $sequence = null)

Вставить новую запись и получить значение первичного ключа.

из Builder
целое insertUsing(массив $columns, $query)

Вставить новые записи в таблицу, используя подзапрос.

из Builder
целое insertOrIgnoreUsing(массив $columns, $query)

Вставить новые записи в таблицу, используя подзапрос, игнорируя ошибки.

из Builder
целое update(массив $values)

Обновить записи в базе данных.

из Builder
целое updateFrom(массив $values)

Обновить записи в базе данных PostgreSQL, используя синтаксис update from.

из Builder
булево updateOrInsert(массив $attributes, массив|вызов $values = [])

Вставить или обновить запись, соответствующую атрибутам, и заполнить её значениями.

из Builder
целое upsert(массив $values, массив|строка $uniqueBy, массив|null $update = null)

Вставить новые записи или обновить существующие.

из Builder
int increment(string $column, float|int $amount = 1, array $extra = [])

Инкрементировать значение столбца на заданную величину.

из Builder
int incrementEach(array $columns, array $extra = [])

Инкрементировать значения указанных столбцов на заданные величины.

из Builder
int decrement(string $column, float|int $amount = 1, array $extra = [])

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

из Builder
int decrementEach(array $columns, array $extra = [])

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

из Builder
int delete(mixed $id = null)

Удалить записи из базы данных.

из Builder
void truncate()

Выполнить операцию truncate для таблицы.

из Builder
Builder newQuery()

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

Builder forSubQuery()

Создать новый экземпляр запроса для подзапроса.

array getColumns()

Получить все столбцы билдера запроса в текстовом массиве с оценкой всех выражений.

из Builder
Expression raw(mixed $value)

Создать выражение для базы данных в сыром виде.

из Builder
Collection getUnionBuilders()

Получить экземпляры билдеров запроса, используемые в объединении запроса.

из Builder
array getBindings()

Получить текущие значения связываемых параметров запроса в плоском массиве.

из Builder
array getRawBindings()

Получить сырой массив связываемых параметров.

из Builder
$this setBindings(array $bindings, string $type = 'where')

Установить связываемые параметры билдера запроса.

из Builder
$this addBinding(mixed $value, string $type = 'where')

Добавить связываемый параметр к запросу.

из Builder
mixed castBinding(mixed $value)

Преобразовать значение связываемого параметра.

из Builder
$this mergeBindings(Builder $query)

Объединить массив связей в наши связи.

from Builder
array cleanBindings(array $bindings)

Удалить все выражения из списка связей.

from Builder
mixed flattenValue(mixed $value)

Получить значение скалярного типа из входных данных неизвестного типа.

from Builder
string defaultKeyName()

Получить имя поля по умолчанию для таблицы.

from Builder
ConnectionInterface getConnection()

Получить экземпляр подключения к базе данных.

from Builder
Processor getProcessor()

Получить экземпляр обработчика запросов к базе данных.

from Builder
Grammar getGrammar()

Получить экземпляр синтаксического анализатора запросов.

from Builder
$this useWritePdo()

Использовать соединение PDO "write" при выполнении запроса.

from Builder
bool isQueryable(mixed $value)

Определить, является ли значение экземпляром билдера запросов или замыканием.

from Builder
Builder clone()

Клонировать запрос.

from Builder
Builder cloneWithout(array $properties)

Клонировать запрос без указанных свойств.

from Builder
Builder cloneWithoutBindings(array $except)

Клонировать запрос без указанных связей.

from Builder
$this dump(mixed ...$args)

Вывести текущий SQL и связи.

from Builder
$this dumpRawSql()

Вывести исходный текущий SQL с вложенными связями.

from Builder
never dd()

Завершить выполнение и вывести текущий SQL и связи.

from Builder
never ddRawSql()

Завершить выполнение и вывести текущий SQL с вложенными связями.

from Builder
$this on(Closure|Expression|string $first, string|null $operator = null, Expression|string|null $second = null, string $boolean = 'and')

Добавить условие "on" к объединению.

JoinClause orOn(Closure|Expression|string $first, string|null $operator = null, Expression|string|null $second = null)

Добавить условие "или on" к объединению.

Builder newParentQuery()

Создать новый экземпляр родительского запроса.

Подробности

$this|TWhenReturnType when($value = null, callable|null $callback = null, callable|null $default = null)

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

Параметры

$value
callable|null $callback
callable|null $default

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

$this|TWhenReturnType

$this|TUnlessReturnType unless($value = null, callable|null $callback = null, callable|null $default = null)

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

Параметры

$value
callable|null $callback
callable|null $default

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

$this|TUnlessReturnType

bool chunk(int $count, callable $callback)

Разбить результаты запроса на куски.

Параметры

int $count
callable $callback

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

bool

TReturn> chunkMap(callable $callback, int $count = 1000)

Выполнить отображение над каждым элементом с разбивкой на куски.

Параметры

callable $callback
int $count

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

TReturn>

bool each(callable $callback, int $count = 1000)

Выполнить обратный вызов над каждым элементом с разбивкой на куски.

Параметры

callable $callback
int $count

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

bool

Исключения

RuntimeException

bool chunkById(int $count, callable $callback, string|null $column = null, string|null $alias = null)

Разбить результаты запроса на куски, сравнивая идентификаторы.

Параметры

int $count
callable $callback
string|null $column
string|null $alias

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

bool

bool chunkByIdDesc(int $count, callable $callback, string|null $column = null, string|null $alias = null)

Разбить результаты запроса по ID в порядке убывания.

Параметры

int $count
callable $callback
string|null $column
string|null $alias

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

bool

bool orderedChunkById(int $count, callable $callback, string|null $column = null, string|null $alias = null, bool $descending = false)

Разбить результаты запроса по ID в заданном порядке.

Параметры

int $count
callable $callback
string|null $column
string|null $alias
bool $descending

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

bool

Исключения

RuntimeException

bool eachById(callable $callback, int $count = 1000, string|null $column = null, string|null $alias = null)

Выполнить обратный вызов над каждым элементом, разбивая по ID.

Параметры

callable $callback
int $count
string|null $column
string|null $alias

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

bool

LazyCollection lazy(int $chunkSize = 1000)

Выполнять запрос лениво, по частям заданного размера.

Параметры

int $chunkSize

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

LazyCollection

Исключения

InvalidArgumentException

LazyCollection lazyById(int $chunkSize = 1000, string|null $column = null, string|null $alias = null)

Ленивый запрос, разбивая результаты запроса по ID.

Параметры

int $chunkSize
string|null $column
string|null $alias

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

LazyCollection

Исключения

InvalidArgumentException

LazyCollection lazyByIdDesc(int $chunkSize = 1000, string|null $column = null, string|null $alias = null)

Ленивый запрос, разбивая результаты запроса по ID в порядке убывания.

Параметры

int $chunkSize
string|null $column
string|null $alias

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

LazyCollection

Исключения

InvalidArgumentException

protected LazyCollection orderedLazyById(int $chunkSize = 1000, string|null $column = null, string|null $alias = null, bool $descending = false)

Выполнить запрос лениво, разбивая результаты запроса на части, сравнивая идентификаторы в заданном порядке.

Параметры

int $chunkSize
string|null $column
string|null $alias
bool $descending

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

LazyCollection

Исключения

InvalidArgumentException

TValue|null first(array|string $columns = ['*'])

Выполнить запрос и получить первый результат.

Параметры

array|string $columns

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

TValue|null

TValue sole(array|string $columns = ['*'])

Выполнить запрос и получить первый результат, если это единственная совпадающая запись.

Параметры

array|string $columns

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

TValue

Исключения

RecordsNotFoundException
MultipleRecordsFoundException

protected CursorPaginator paginateUsingCursor(int $perPage, array|string $columns = ['*'], string $cursorName = 'cursor', Cursor|string|null $cursor = null)

Выполнить постраничную разбивку заданного запроса с помощью постраничной разбивки с курсором.

Параметры

int $perPage
array|string $columns
string $cursorName
Cursor|string|null $cursor

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

CursorPaginator

protected string getOriginalColumnNameForCursorPagination($builder, string $parameter)

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

Параметры

$builder
string $parameter

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

string

protected LengthAwarePaginator paginator(Collection $items, int $total, int $perPage, int $currentPage, array $options)

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

Параметры

Collection $items
int $total
int $perPage
int $currentPage
array $options

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

LengthAwarePaginator

protected Paginator simplePaginator(Collection $items, int $perPage, int $currentPage, array $options)

Создать новый экземпляр простого пагинатора.

Параметры

Collection $items
int $perPage
int $currentPage
array $options

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

Paginator

protected CursorPaginator cursorPaginator(Collection $items, int $perPage, Cursor $cursor, array $options)

Создать новый экземпляр пагинатора с курсором.

Параметры

Collection $items
int $perPage
Cursor $cursor
array $options

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

CursorPaginator

$this tap($callback)

Передать запрос в предоставленный обратный вызов.

Параметры

$callback

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

$this

Collection explain()

Объяснить запрос.

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

Collection

protected mixed forwardCallTo(mixed $object, string $method, array $parameters)

Перенаправить вызов метода к заданному объекту.

Параметры

mixed $object
string $method
array $parameters

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

mixed

Исключения

BadMethodCallException

protected mixed forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Перенаправить вызов метода к заданному объекту, возвращая $this, если перенаправленный вызов вернул сам себя.

Параметры

mixed $object
string $method
array $parameters

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

mixed

Исключения

BadMethodCallException

static protected void throwBadMethodCallException(string $method)

Выбросить исключение BadMethodCallException для данного метода.

Параметры

string $method

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

void

Исключения

BadMethodCallException

static void macro(string $name, object|callable $macro)

Зарегистрировать пользовательское макрокоманду.

Параметры

string $name
object|callable $macro

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

void

static void mixin(object $mixin, bool $replace = true)

Смешать другой объект в класс.

Параметры

object $mixin
bool $replace

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

void

Исключения

ReflectionException

static bool hasMacro(string $name)

Проверить, зарегистрирована ли макрокоманда.

Параметры

string $name

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

bool

static void flushMacros()

Очистить существующие макрокоманды.

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

void

static mixed __callStatic(string $method, array $parameters)

Динамически обработать вызовы класса.

Параметры

string $method
array $parameters

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

mixed

Исключения

BadMethodCallException

mixed __call(string $method, array $parameters)

Динамически обработать вызовы класса.

Параметры

string $method
array $parameters

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

mixed

Исключения

BadMethodCallException

void __construct(Builder $parentQuery, string $type, string $table)

Создать новый экземпляр предложения соединения.

Параметры

Builder $parentQuery
string $type
string $table

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

void

$this select(array|mixed $columns = ['*'])

Установить столбцы для выбора.

Параметры

array|mixed $columns

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

$this

$this selectSub($query, string $as)

Добавить выражение подзапроса в запрос.

Параметры

$query
string $as

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

$this

Исключения

InvalidArgumentException

$this selectRaw(string $expression, array $bindings = [])

Добавить новое выражение выбора "raw" в запрос.

Параметры

string $expression
array $bindings

Значение возврата

$this

$this fromSub($query, string $as)

Выполняет выборку из подзапроса.

Параметры

$query
string $as

Значение возврата

$this

Исключения

InvalidArgumentException

$this fromRaw(string $expression, mixed $bindings = [])

Добавить в запрос условие from с использованием raw SQL.

Параметры

string $expression
mixed $bindings

Значение возврата

$this

protected array createSub($query)

Создаёт подзапрос и анализирует его.

Параметры

$query

Значение возврата

array

protected array parseSub(mixed $query)

Анализирует подзапрос, преобразуя его в SQL и параметры.

Параметры

mixed $query

Значение возврата

array

Исключения

InvalidArgumentException

protected mixed prependDatabaseNameIfCrossDatabaseQuery(mixed $query)

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

Параметры

mixed $query

Значение возврата

mixed

$this addSelect(array|mixed $column)

Добавить новый столбец в выборку.

Параметры

array|mixed $column

Значение возврата

$this

$this distinct()

Выбрать только уникальные результаты.

Значение возврата

$this

$this from($table, string|null $as = null)

Указать таблицу для запроса.

Параметры

$table
string|null $as

Значение возврата

$this

$this useIndex(string $index)

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

Параметры

string $index

Значение возврата

$this

$this forceIndex(string $index)

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

Параметры

string $index

Значение результата

$this

$this ignoreIndex(string $index)

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

Параметры

string $index

Значение результата

$this

$this join(Expression|string $table, Closure|Expression|string $first, string|null $operator = null, Expression|string|null $second = null, string $type = 'inner', bool $where = false)

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

Параметры

Expression|string $table
Closure|Expression|string $first
string|null $operator
Expression|string|null $second
string $type
bool $where

Значение результата

$this

$this joinWhere(Expression|string $table, Closure|Expression|string $first, string $operator, Expression|string $second, string $type = 'inner')

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

Параметры

Expression|string $table
Closure|Expression|string $first
string $operator
Expression|string $second
string $type

Значение результата

$this

$this joinSub($query, string $as, Closure|Expression|string $first, string|null $operator = null, Expression|string|null $second = null, string $type = 'inner', bool $where = false)

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

Параметры

$query
string $as
Closure|Expression|string $first
string|null $operator
Expression|string|null $second
string $type
bool $where

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

$this

Исключения

InvalidArgumentException

$this joinLateral($query, string $as, string $type = 'inner')

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

Параметры

$query
string $as
string $type

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

$this

$this leftJoinLateral($query, string $as)

Добавить левое объединение lateral к запросу.

Параметры

$query
string $as

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

$this

$this leftJoin(Expression|string $table, Closure|Expression|string $first, string|null $operator = null, Expression|string|null $second = null)

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

Параметры

Expression|string $table
Closure|Expression|string $first
string|null $operator
Expression|string|null $second

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

$this

$this leftJoinWhere(Expression|string $table, Closure|Expression|string $first, string $operator, Expression|string|null $second)

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

Параметры

Expression|string $table
Closure|Expression|string $first
string $operator
Expression|string|null $second

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

$this

$this leftJoinSub($query, string $as, Closure|Expression|string $first, string|null $operator = null, Expression|string|null $second = null)

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

Параметры

$query
string $as
Closure|Expression|string $first
string|null $operator
Expression|string|null $second

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

$this

$this rightJoin(Expression|string $table, Closure|string $first, string|null $operator = null, Expression|string|null $second = null)

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

Параметры

Expression|string $table
Closure|string $first
string|null $operator
Expression|string|null $second

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

$this

$this rightJoinWhere(Expression|string $table, Closure|Expression|string $first, string $operator, Expression|string $second)

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

Параметры

Expression|string $table
Closure|Expression|string $first
string $operator
Expression|string $second

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

$this

$this rightJoinSub($query, string $as, Closure|Expression|string $first, string|null $operator = null, Expression|string|null $second = null)

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

Параметры

$query
string $as
Closure|Expression|string $first
string|null $operator
Expression|string|null $second

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

$this

$this crossJoin(Expression|string $table, Closure|Expression|string|null $first = null, string|null $operator = null, Expression|string|null $second = null)

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

Параметры

Expression|string $table
Closure|Expression|string|null $first
string|null $operator
Expression|string|null $second

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

$this

$this crossJoinSub($query, string $as)

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

Параметры

$query
string $as

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

$this

protected JoinClause newJoinClause(Builder $parentQuery, string $type, string $table)

Получить новое условие объединения.

Параметры

Builder $parentQuery
string $type
string $table

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

JoinClause

protected JoinLateralClause newJoinLateralClause(Builder $parentQuery, string $type, string $table)

Получить новое условие объединения LATERAL.

Параметры

Builder $parentQuery
string $type
string $table

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

JoinLateralClause

$this mergeWheres(array $wheres, array $bindings)

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

Параметры

array $wheres
array $bindings

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

$this

$this where(Closure|string|array|Expression $column, mixed $operator = null, mixed $value = null, string $boolean = 'and')

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

Параметры

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

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

$this

protected $this addArrayOfWheres(array $column, string $boolean, string $method = 'where')

Добавить массив условий where к запросу.

Параметры

array $column
string $boolean
string $method

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

$this

array prepareValueAndOperator(string $value, string $operator, bool $useDefault = false)

Подготовить значение и оператор для условия where.

Параметры

string $value
string $operator
bool $useDefault

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

array

Исключения

InvalidArgumentException

protected bool invalidOperatorAndValue(string $operator, mixed $value)

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

Предотвращает использование Null значений с недопустимыми операторами.

Параметры

string $operator
mixed $value

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

bool

protected bool invalidOperator(string $operator)

Определить, поддерживается ли заданный оператор.

Параметры

string $operator

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

bool

protected bool isBitwiseOperator(string $operator)

Определить, является ли оператор побитовым оператором.

Параметры

string $operator

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

bool

$this orWhere(Closure|string|array|Expression $column, mixed $operator = null, mixed $value = null)

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

Параметры

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

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

$this

$this whereNot(Closure|string|array|Expression $column, mixed $operator = null, mixed $value = null, string $boolean = 'and')

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

Параметры

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

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

$this

$this orWhereNot(Closure|string|array|Expression $column, mixed $operator = null, mixed $value = null)

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

Параметры

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

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

$this

$this whereColumn(Expression|string|array $first, string|null $operator = null, string|null $second = null, string|null $boolean = 'and')

Добавить условие «где» для сравнения двух столбцов к запросу.

Параметры

Expression|string|array $first
string|null $operator
string|null $second
string|null $boolean

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

$this

$this orWhereColumn(Expression|string|array $first, string|null $operator = null, string|null $second = null)

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

Параметры

Expression|string|array $first
string|null $operator
string|null $second

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

$this

$this whereRaw(string $sql, mixed $bindings = [], string $boolean = 'and')

Добавить условие «где» в сыром виде к запросу.

Параметры

string $sql
mixed $bindings
string $boolean

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

$this

$this orWhereRaw(string $sql, mixed $bindings = [])

Добавить условие «или где» в сыром виде к запросу.

Параметры

string $sql
mixed $bindings

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

$this

$this whereIn(Expression|string $column, mixed $values, string $boolean = 'and', bool $not = false)

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

Параметры

Expression|string $column
mixed $values
string $boolean
bool $not

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

$this

$this orWhereIn(Expression|string $column, mixed $values)

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

Параметры

Expression|string $column
mixed $values

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

$this

$this whereNotIn(Expression|string $column, mixed $values, string $boolean = 'and')

Добавить условие «не в» к запросу.

Параметры

Expression|string $column
mixed $values
string $boolean

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

$this

$this orWhereNotIn(Expression|string $column, mixed $values)

Добавить условие «или не в» к запросу.

Параметры

Expression|string $column
mixed $values

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

$this

$this whereIntegerInRaw(string $column, Arrayable|array $values, string $boolean = 'and', bool $not = false)

Добавить условие «where in raw» для целочисленных значений в запрос.

Параметры

string $column
Arrayable|array $values
string $boolean
bool $not

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

$this

$this orWhereIntegerInRaw(string $column, Arrayable|array $values)

Добавить условие «or where in raw» для целочисленных значений в запрос.

Параметры

string $column
Arrayable|array $values

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

$this

$this whereIntegerNotInRaw(string $column, Arrayable|array $values, string $boolean = 'and')

Добавить условие «where not in raw» для целочисленных значений в запрос.

Параметры

string $column
Arrayable|array $values
string $boolean

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

$this

$this orWhereIntegerNotInRaw(string $column, Arrayable|array $values)

Добавить условие «or where not in raw» для целочисленных значений в запрос.

Параметры

string $column
Arrayable|array $values

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

$this

$this whereNull(string|array|Expression $columns, string $boolean = 'and', bool $not = false)

Добавить условие «where null» в запрос.

Параметры

string|array|Expression $columns
string $boolean
bool $not

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

$this

$this orWhereNull(string|array|Expression $column)

Добавить условие «or where null» в запрос.

Параметры

string|array|Expression $column

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

$this

$this whereNotNull(string|array|Expression $columns, string $boolean = 'and')

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

Параметры

string|array|Expression $columns
string $boolean

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

$this

$this whereBetween(Expression|string $column, iterable $values, string $boolean = 'and', bool $not = false)

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

Параметры

Expression|string $column
iterable $values
string $boolean
bool $not

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

$this

$this whereBetweenColumns(Expression|string $column, array $values, string $boolean = 'and', bool $not = false)

Добавить условие where between, используя столбцы, к запросу.

Параметры

Expression|string $column
array $values
string $boolean
bool $not

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

$this

$this orWhereBetween(Expression|string $column, iterable $values)

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

Параметры

Expression|string $column
iterable $values

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

$this

$this orWhereBetweenColumns(Expression|string $column, array $values)

Добавить условие or where between, используя столбцы, к запросу.

Параметры

Expression|string $column
array $values

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

$this

$this whereNotBetween(Expression|string $column, iterable $values, string $boolean = 'and')

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

Параметры

Expression|string $column
iterable $values
string $boolean

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

$this

$this whereNotBetweenColumns(Expression|string $column, array $values, string $boolean = 'and')

Добавить условие where not between с использованием столбцов в запрос.

Параметры

Expression|string $column
array $values
string $boolean

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

$this

$this orWhereNotBetween(Expression|string $column, iterable $values)

Добавить условие or where not between в запрос.

Параметры

Expression|string $column
iterable $values

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

$this

$this orWhereNotBetweenColumns(Expression|string $column, array $values)

Добавить условие or where not between с использованием столбцов в запрос.

Параметры

Expression|string $column
array $values

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

$this

$this orWhereNotNull(Expression|string $column)

Добавить условие "or where not null" в запрос.

Параметры

Expression|string $column

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

$this

$this whereDate(Expression|string $column, DateTimeInterface|string|null $operator, DateTimeInterface|string|null $value = null, string $boolean = 'and')

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

Параметры

Expression|string $column
DateTimeInterface|string|null $operator
DateTimeInterface|string|null $value
string $boolean

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

$this

$this orWhereDate(Expression|string $column, DateTimeInterface|string|null $operator, DateTimeInterface|string|null $value = null)

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

Параметры

Expression|string $column
DateTimeInterface|string|null $operator
DateTimeInterface|string|null $value

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

$this

$this whereTime(Expression|string $column, DateTimeInterface|string|null $operator, DateTimeInterface|string|null $value = null, string $boolean = 'and')

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

Параметры

Expression|string $column
DateTimeInterface|string|null $operator
DateTimeInterface|string|null $value
string $boolean

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

$this

$this orWhereTime(Expression|string $column, DateTimeInterface|string|null $operator, DateTimeInterface|string|null $value = null)

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

Параметры

Expression|string $column
DateTimeInterface|string|null $operator
DateTimeInterface|string|null $value

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

$this

$this whereDay(Expression|string $column, DateTimeInterface|string|int|null $operator, DateTimeInterface|string|int|null $value = null, string $boolean = 'and')

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

Параметры

Expression|string $column
DateTimeInterface|string|int|null $operator
DateTimeInterface|string|int|null $value
string $boolean

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

$this

$this orWhereDay(Expression|string $column, DateTimeInterface|string|int|null $operator, DateTimeInterface|string|int|null $value = null)

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

Параметры

Expression|string $column
DateTimeInterface|string|int|null $operator
DateTimeInterface|string|int|null $value

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

$this

$this whereMonth(Expression|string $column, DateTimeInterface|string|int|null $operator, DateTimeInterface|string|int|null $value = null, string $boolean = 'and')

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

Параметры

Expression|string $column
DateTimeInterface|string|int|null $operator
DateTimeInterface|string|int|null $value
string $boolean

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

$this

$this orWhereMonth(Expression|string $column, DateTimeInterface|string|int|null $operator, DateTimeInterface|string|int|null $value = null)

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

Параметры

Expression|string $column
DateTimeInterface|string|int|null $operator
DateTimeInterface|string|int|null $value

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

$this

$this whereYear(Expression|string $column, DateTimeInterface|string|int|null $operator, DateTimeInterface|string|int|null $value = null, string $boolean = 'and')

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

Параметры

Expression|string $column
DateTimeInterface|string|int|null $operator
DateTimeInterface|string|int|null $value
string $boolean

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

$this

$this orWhereYear(Expression|string $column, DateTimeInterface|string|int|null $operator, DateTimeInterface|string|int|null $value = null)

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

Параметры

Expression|string $column
DateTimeInterface|string|int|null $operator
DateTimeInterface|string|int|null $value

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

$this

protected $this addDateBasedWhere(string $type, Expression|string $column, string $operator, mixed $value, string $boolean = 'and')

Добавить условие, основанное на дате (год, месяц, день, время), в запрос.

Параметры

string $type
Expression|string $column
string $operator
mixed $value
string $boolean

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

$this

$this whereNested(Closure $callback, string $boolean = 'and')

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

Параметры

Closure $callback
string $boolean

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

$this

Builder forNestedWhere()

Создать новый экземпляр запроса для вложенного условия where.

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

Builder

$this addNestedWhereQuery(Builder $query, string $boolean = 'and')

Добавить другой объект Query Builder как вложенное условие where к объекту Query Builder.

Параметры

Builder $query
string $boolean

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

$this

protected $this whereSub(Expression|string $column, string $operator, $callback, string $boolean)

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

Параметры

Expression|string $column
string $operator
$callback
string $boolean

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

$this

$this whereExists($callback, string $boolean = 'and', bool $not = false)

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

Параметры

$callback
строка $boolean
логическое $not

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

$this

$this orWhereExists($callback, bool $not = false)

Добавить условие or exists в запрос.

Параметры

$callback
логическое $not

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

$this

$this whereNotExists($callback, string $boolean = 'and')

Добавить условие where not exists в запрос.

Параметры

$callback
строка $boolean

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

$this

$this orWhereNotExists($callback)

Добавить условие or where not exists в запрос.

Параметры

$callback

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

$this

$this addWhereExistsQuery(Builder $query, string $boolean = 'and', bool $not = false)

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

Параметры

Builder $query
строка $boolean
логическое $not

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

$this

$this whereRowValues(array $columns, string $operator, array $values, string $boolean = 'and')

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

Параметры

массив $columns
строка $operator
массив $values
строка $boolean

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

$this

Исключения

InvalidArgumentException

$this orWhereRowValues(array $columns, string $operator, array $values)

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

Параметры

массив $columns
строка $operator
массив $values

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

$this

$this whereJsonContains(string $column, mixed $value, string $boolean = 'and', bool $not = false)

Добавить условие "where JSON содержит" в запрос.

Параметры

строка $column
смешанный $value
строка $boolean
логическое $not

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

$this

$this orWhereJsonContains(string $column, mixed $value)

Добавить условие «или где JSON содержит» к запросу.

Parameters

string $column
mixed $value

Return Value

$this

$this whereJsonDoesntContain(string $column, mixed $value, string $boolean = 'and')

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

Parameters

string $column
mixed $value
string $boolean

Return Value

$this

$this orWhereJsonDoesntContain(string $column, mixed $value)

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

Parameters

string $column
mixed $value

Return Value

$this

$this whereJsonOverlaps(string $column, mixed $value, string $boolean = 'and', bool $not = false)

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

Parameters

string $column
mixed $value
string $boolean
bool $not

Return Value

$this

$this orWhereJsonOverlaps(string $column, mixed $value)

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

Parameters

string $column
mixed $value

Return Value

$this

$this whereJsonDoesntOverlap(string $column, mixed $value, string $boolean = 'and')

Добавить условие «где JSON не перекрывается» к запросу.

Parameters

string $column
mixed $value
string $boolean

Return Value

$this

$this orWhereJsonDoesntOverlap(string $column, mixed $value)

Добавить условие «или где JSON не перекрывается» к запросу.

Parameters

string $column
mixed $value

Return Value

$this

$this whereJsonContainsKey(string $column, string $boolean = 'and', bool $not = false)

Добавить условие, определяющее существование JSON пути в запросе.

Parameters

string $column
string $boolean
bool $not

Return Value

$this

$this orWhereJsonContainsKey(string $column)

Добавить условие «или» для определения существования JSON пути в запросе.

Parameters

string $column

Return Value

$this

$this whereJsonDoesntContainKey(string $column, string $boolean = 'and')

Добавить условие, определяющее, если JSON-путь не существует в запросе.

Parameters

string $column
string $boolean

Return Value

$this

$this orWhereJsonDoesntContainKey(string $column)

Добавить условие "или", определяющее, если JSON-путь не существует в запросе.

Parameters

string $column

Return Value

$this

$this whereJsonLength(string $column, mixed $operator, mixed $value = null, string $boolean = 'and')

Добавить условие "длина JSON" в запрос.

Parameters

string $column
mixed $operator
mixed $value
string $boolean

Return Value

$this

$this orWhereJsonLength(string $column, mixed $operator, mixed $value = null)

Добавить условие "или длина JSON" в запрос.

Parameters

string $column
mixed $operator
mixed $value

Return Value

$this

$this dynamicWhere(string $method, array $parameters)

Обрабатывает динамические условия "where" в запросе.

Parameters

string $method
array $parameters

Return Value

$this

protected void addDynamic(string $segment, string $connector, array $parameters, int $index)

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

Parameters

string $segment
string $connector
array $parameters
int $index

Return Value

void

$this whereFullText(string|string[] $columns, string $value, array $options = [], string $boolean = 'and')

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

Parameters

string|string[] $columns
string $value
array $options
string $boolean

Return Value

$this

$this orWhereFullText(string|string[] $columns, string $value, array $options = [])

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

Parameters

string|string[] $columns
string $value
array $options

Return Value

$this

$this whereAll(string[] $columns, mixed $operator = null, mixed $value = null, string $boolean = 'and')

Добавить условие «where» к запросу для нескольких столбцов с условиями «and» между ними.

Параметры

string[] $columns
mixed $operator
mixed $value
string $boolean

Значение возврата

$this

$this orWhereAll(string[] $columns, string $operator = null, mixed $value = null)

Добавить условие «or where» к запросу для нескольких столбцов с условиями «and» между ними.

Параметры

string[] $columns
string $operator
mixed $value

Значение возврата

$this

$this whereAny(string[] $columns, string $operator = null, mixed $value = null, string $boolean = 'and')

Добавить условие «where» к запросу для нескольких столбцов с условиями «or» между ними.

Параметры

string[] $columns
string $operator
mixed $value
string $boolean

Значение возврата

$this

$this orWhereAny(string[] $columns, string $operator = null, mixed $value = null)

Добавить условие «or where» к запросу для нескольких столбцов с условиями «or» между ними.

Параметры

string[] $columns
string $operator
mixed $value

Значение возврата

$this

$this groupBy(array|Expression|string ...$groups)

Добавить условие «group by» к запросу.

Параметры

array|Expression|string ...$groups

Значение возврата

$this

$this groupByRaw(string $sql, array $bindings = [])

Добавить условие «groupBy» в сыром виде к запросу.

Параметры

string $sql
array $bindings

Значение возврата

$this

$this having(Expression|Closure|string $column, string|int|float|null $operator = null, string|int|float|null $value = null, string $boolean = 'and')

Добавить условие «having» к запросу.

Параметры

Expression|Closure|string $column
string|int|float|null $operator
string|int|float|null $value
string $boolean

Значение возврата

$this

$this orHaving(Expression|Closure|string $column, string|int|float|null $operator = null, string|int|float|null $value = null)

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

Параметры

Expression|Closure|строка $column
строка|целое число|число с плавающей точкой|null $operator
строка|целое число|число с плавающей точкой|null $value

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

$this

$this havingNested(Closure $callback, string $boolean = 'and')

Добавить вложенное условие "имеющий" к запросу.

Параметры

Closure $callback
строка $boolean

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

$this

$this addNestedHavingQuery(Builder $query, string $boolean = 'and')

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

Параметры

Builder $query
строка $boolean

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

$this

$this havingNull(string|array $columns, string $boolean = 'and', bool $not = false)

Добавить условие "имеющий null" к запросу.

Параметры

строка|массив $columns
строка $boolean
логическое значение $not

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

$this

$this orHavingNull(string $column)

Добавить условие "или имеющий null" к запросу.

Параметры

строка $column

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

$this

$this havingNotNull(string|array $columns, string $boolean = 'and')

Добавить условие "имеющий не null" к запросу.

Параметры

строка|массив $columns
строка $boolean

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

$this

$this orHavingNotNull(string $column)

Добавить условие "или имеющий не null" к запросу.

Параметры

строка $column

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

$this

$this havingBetween(string $column, iterable $values, string $boolean = 'and', bool $not = false)

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

Параметры

строка $column
iterable $values
строка $boolean
логическое значение $not

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

$this

$this havingRaw(string $sql, array $bindings = [], string $boolean = 'and')

Добавить в запрос условие having с необработанным SQL.

Параметры

строка $sql
массив $bindings
строка $boolean

Значение результата

$this

$this orHavingRaw(string $sql, array $bindings = [])

Добавить в запрос условие having OR с необработанным SQL.

Параметры

строка $sql
массив $bindings

Значение результата

$this

$this orderBy($column, string $direction = 'asc')

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

Параметры

$column
строка $direction

Значение результата

$this

Исключения

InvalidArgumentException

$this orderByDesc($column)

Добавить условие сортировки «по убыванию» в запрос.

Параметры

$column

Значение результата

$this

$this latest(Closure|Builder|Expression|string $column = 'created_at')

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

Параметры

Closure|Builder|Expression|строка $column

Значение результата

$this

$this oldest(Closure|Builder|Expression|string $column = 'created_at')

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

Параметры

Closure|Builder|Expression|строка $column

Значение результата

$this

$this inRandomOrder(string|int $seed = '')

Установить случайный порядок результатов запроса.

Параметры

строка|целое $seed

Значение результата

$this

$this orderByRaw(string $sql, array $bindings = [])

Добавить в запрос условие сортировки с необработанным SQL.

Параметры

строка $sql
массив $bindings

Значение результата

$this

$this skip(int $value)

Псевдоним для установки значения "смещения" запроса.

Параметры

int $value

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

$this

$this offset(int $value)

Установить значение "смещения" запроса.

Параметры

int $value

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

$this

$this take(int $value)

Псевдоним для установки значения "лимита" запроса.

Параметры

int $value

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

$this

$this limit(int $value)

Установить значение "лимита" запроса.

Параметры

int $value

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

$this

$this groupLimit(int $value, string $column)

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

Параметры

int $value
string $column

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

$this

$this forPage(int $page, int $perPage = 15)

Установить лимит и смещение для заданной страницы.

Параметры

int $page
int $perPage

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

$this

$this forPageBeforeId(int $perPage = 15, int|null $lastId = 0, string $column = 'id')

Ограничить запрос предыдущей "страницей" результатов до заданного ID.

Параметры

int $perPage
int|null $lastId
string $column

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

$this

$this forPageAfterId(int $perPage = 15, int|null $lastId = 0, string $column = 'id')

Ограничить запрос следующей "страницей" результатов после заданного ID.

Параметры

int $perPage
int|null $lastId
string $column

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

$this

$this reorder(Closure|Builder|Expression|string|null $column = null, string $direction = 'asc')

Удалить все существующие сортировки и, при необходимости, добавить новую.

Параметры

Closure|Builder|Expression|string|null $column
string $direction

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

$this

protected array removeExistingOrdersFor(string $column)

Получить массив со всеми заказами, у которых удалён указанный столбец.

Parameters

string $column

Return Value

array

$this union($query, bool $all = false)

Добавить оператор объединения в запрос.

Parameters

$query
bool $all

Return Value

$this

$this unionAll($query)

Добавить оператор объединения со всеми результатами в запрос.

Parameters

$query

Return Value

$this

$this lock(string|bool $value = true)

Заблокировать выбранные строки в таблице.

Parameters

string|bool $value

Return Value

$this

$this lockForUpdate()

Заблокировать выбранные строки в таблице для обновления.

Return Value

$this

$this sharedLock()

Заблокировать выбранные строки в таблице с совместным доступом.

Return Value

$this

$this beforeQuery(callable $callback)

Зарегистрировать замыкание, которое будет вызываться перед выполнением запроса.

Parameters

callable $callback

Return Value

$this

void applyBeforeQueryCallbacks()

Вызвать обработчики модификации "перед запросом".

Return Value

void

$this afterQuery(Closure $callback)

Зарегистрировать замыкание, которое будет вызываться после выполнения запроса.

Parameters

Closure $callback

Return Value

$this

mixed applyAfterQueryCallbacks(mixed $result)

Вызвать обработчики модификации "после запроса".

Parameters

mixed $result

Return Value

mixed

string toSql()

Получить SQL-представление запроса.

Return Value

string

string toRawSql()

Получить необработанное SQL-представление запроса со встроенными значениями связей.

Return Value

string

object|null find(int|string $id, array|string $columns = ['*'])

Выполнить запрос для получения одной записи по ID.

Параметры

int|string $id
array|string $columns

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

object|null

findOr($id, $columns = ['*'], Closure|null $callback = null)

Описание отсутствует

Параметры

$id
$columns
Closure|null $callback

mixed value(string $column)

Получить значение одного столбца из первого результата запроса.

Параметры

string $column

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

mixed

mixed rawValue(string $expression, array $bindings = [])

Получить значение одного выражения из первого результата запроса.

Параметры

string $expression
array $bindings

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

mixed

mixed soleValue(string $column)

Получить значение одного столбца из первого результата запроса, если это единственная соответствующая запись.

Параметры

string $column

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

mixed

Исключения

RecordsNotFoundException
MultipleRecordsFoundException

Collection get(array|string $columns = ['*'])

Выполнить запрос как операцию «выбор».

Параметры

array|string $columns

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

Collection

protected array runSelect()

Выполнить запрос как операцию «выбор» по подключению.

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

array

protected Collection withoutGroupLimitKeys(Collection $items)

Удалить ключи группового лимита из результатов в коллекции.

Параметры

Collection $items

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

Collection

LengthAwarePaginator paginate(int|Closure $perPage = 15, array|string $columns = ['*'], string $pageName = 'page', int|null $page = null, Closure|int|null $total = null)

Разбить заданный запрос на страницы с помощью простого пагинатора.

Параметры

int|Closure $perPage
array|string $columns
string $pageName
int|null $page
Closure|int|null $total

Значение, возвращаемое функцией

LengthAwarePaginator

Paginator simplePaginate(int $perPage = 15, array|string $columns = ['*'], string $pageName = 'page', int|null $page = null)

Получить пагинатор, поддерживающий только простые ссылки «Следующая» и «Предыдущая».

Это более эффективно для больших наборов данных и т. д.

Параметры

int $perPage
array|string $columns
string $pageName
int|null $page

Значение, возвращаемое функцией

Paginator

CursorPaginator cursorPaginate(int|null $perPage = 15, array|string $columns = ['*'], string $cursorName = 'cursor', Cursor|string|null $cursor = null)

Получить пагинатор, поддерживающий только простые ссылки «Следующая» и «Предыдущая».

Это более эффективно для больших наборов данных и т. д.

Параметры

int|null $perPage
array|string $columns
string $cursorName
Cursor|string|null $cursor

Значение, возвращаемое функцией

CursorPaginator

protected Collection ensureOrderForCursorPagination(bool $shouldReverse = false)

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

Параметры

bool $shouldReverse

Значение, возвращаемое функцией

Collection

int getCountForPagination(array $columns = ['*'])

Получить количество всех записей для пагинатора.

Параметры

array $columns

Значение, возвращаемое функцией

int

protected array runPaginationCountQuery(array $columns = ['*'])

Выполнить запрос подсчета для пагинации.

Параметры

array $columns

Значение, возвращаемое функцией

array

protected Builder cloneForPaginationCount()

Клонировать существующий экземпляр запроса для использования в подзапросе постраничной навигации.

Значение возврата

Builder

protected array withoutSelectAliases(array $columns)

Удалить алиасы столбцов, поскольку они нарушают запросы подсчёта.

Параметры

array $columns

Значение возврата

array

LazyCollection cursor()

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

Значение возврата

LazyCollection

protected void enforceOrderBy()

Выбросить исключение, если в запросе нет условия orderBy.

Значение возврата

void

Исключения

RuntimeException

Collection<array-key,mixed> pluck(Expression|string $column, string|null $key = null)

Получить экземпляр коллекции, содержащий значения заданного столбца.

Параметры

Expression|string $column
string|null $key

Значение возврата

Collection<array-key,mixed>

protected string|null stripTableForPluck(string $column)

Удалить имя таблицы или псевдоним из идентификатора столбца.

Параметры

string $column

Значение возврата

string|null

protected Collection pluckFromObjectColumn(array $queryResult, string $column, string $key)

Извлечь значения столбцов из строк, представленных как объекты.

Параметры

array $queryResult
string $column
string $key

Значение возврата

Collection

protected Collection pluckFromArrayColumn(array $queryResult, string $column, string $key)

Извлечь значения столбцов из строк, представленных как массивы.

Параметры

array $queryResult
string $column
string $key

Значение возврата

Collection

string implode(string $column, string $glue = '')

Объединить значения заданного столбца в строку.

Параметры

string $column
string $glue

Значение возврата

string

bool exists()

Определить, существуют ли строки для текущего запроса.

Значение возврата

bool

bool doesntExist()

Определить, не существуют ли строки для текущего запроса.

Значение возврата

bool

mixed existsOr(Closure $callback)

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

Параметры

Closure $callback

Значение возврата

mixed

mixed doesntExistOr(Closure $callback)

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

Параметры

Closure $callback

Значение возврата

mixed

int count(Expression|string $columns = '*')

Получить результат "подсчета" запроса.

Параметры

Expression|string $columns

Значение возврата

int

mixed min(Expression|string $column)

Получить минимальное значение заданного столбца.

Параметры

Expression|string $column

Значение возврата

mixed

mixed max(Expression|string $column)

Получить максимальное значение заданного столбца.

Параметры

Expression|string $column

Значение возврата

mixed

mixed sum(Expression|string $column)

Получить сумму значений заданного столбца.

Параметры

Expression|string $column

Значение возврата

mixed

mixed avg(Expression|string $column)

Получить среднее значение значений заданного столбца.

Параметры

Expression|string $column

Значение возврата

mixed

смешанный average(Expression|string $column)

Псевдоним для метода "avg".

Параметры

Expression|string $column

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

смешанный

смешанный aggregate(string $function, array $columns = ['*'])

Выполнение агрегатной функции на базе данных.

Параметры

string $function
array $columns

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

смешанный

float|int numericAggregate(string $function, array $columns = ['*'])

Выполнение числовой агрегатной функции на базе данных.

Параметры

string $function
array $columns

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

float|int

protected $this setAggregate(string $function, array $columns)

Установить свойство агрегации без выполнения запроса.

Параметры

string $function
array $columns

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

$this

protected смешанный onceWithColumns(array $columns, callable $callback)

Выполнить переданный обратный вызов, выбрав указанные столбцы.

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

Параметры

array $columns
callable $callback

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

смешанный

bool insert(array $values)

Вставка новых записей в базу данных.

Параметры

array $values

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

bool

int insertOrIgnore(array $values)

Вставка новых записей в базу данных с игнорированием ошибок.

Параметры

array $values

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

int

int insertGetId(array $values, string|null $sequence = null)

Вставка новой записи и получение значения первичного ключа.

Параметры

array $values
string|null $sequence

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

int

int insertUsing(array $columns, $query)

Вставка новых записей в таблицу с использованием подзапроса.

Параметры

array $columns
$query

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

int

int insertOrIgnoreUsing(array $columns, $query)

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

Параметры

массив $columns
$query

Значение результата

int

int update(array $values)

Обновление записей в базе данных.

Параметры

массив $values

Значение результата

int

int updateFrom(array $values)

Обновление записей в базе данных PostgreSQL с использованием синтаксиса update from.

Параметры

массив $values

Значение результата

int

bool updateOrInsert(array $attributes, array|callable $values = [])

Вставка или обновление записи, соответствующей атрибутам, и заполнение её значениями.

Параметры

массив $attributes
массив|вызываемый объект $values

Значение результата

bool

int upsert(array $values, array|string $uniqueBy, array|null $update = null)

Вставка новых записей или обновление существующих.

Параметры

массив $values
массив|строка $uniqueBy
массив|null $update

Значение результата

int

int increment(string $column, float|int $amount = 1, array $extra = [])

Увеличение значения столбца на заданную величину.

Параметры

строка $column
число с плавающей точкой|целое число $amount
массив $extra

Значение результата

int

Исключения

InvalidArgumentException

int incrementEach(array $columns, array $extra = [])

Увеличение значений указанных столбцов на заданные величины.

Параметры

массив $columns
массив $extra

Значение результата

int

Исключения

InvalidArgumentException

int decrement(string $column, float|int $amount = 1, array $extra = [])

Уменьшение значения столбца на заданную величину.

Параметры

строка $column
число с плавающей точкой|целое число $amount
массив $extra

Значение результата

int

Исключения

InvalidArgumentException
END_OF_DOCUMENT_MARKER

int decrementEach(array $columns, array $extra = [])

Уменьшите значения указанных столбцов на заданные величины.

Parameters

array $columns
array $extra

Return Value

int

Exceptions

InvalidArgumentException

int delete(mixed $id = null)

Удалить записи из базы данных.

Parameters

mixed $id

Return Value

int

void truncate()

Выполнить операцию truncate для таблицы.

Return Value

void

Builder newQuery()

Получить новый экземпляр билдера для объединения.

Return Value

Builder

protected Builder forSubQuery()

Создать новый экземпляр запроса для подзапроса.

Return Value

Builder

array getColumns()

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

Return Value

array

Expression raw(mixed $value)

Создать выражение для базы данных в сыром виде.

Parameters

mixed $value

Return Value

Expression

protected Collection getUnionBuilders()

Получить экземпляры билдеров запроса, используемые в объединении запроса.

Return Value

Collection

array getBindings()

Получить текущие параметры запроса в плоском массиве.

Return Value

array

array getRawBindings()

Получить сырой массив параметров.

Return Value

array

$this setBindings(array $bindings, string $type = 'where')

Установить параметры для билдера запроса.

Parameters

array $bindings
string $type

Return Value

$this

Exceptions

InvalidArgumentException

$this addBinding(mixed $value, string $type = 'where')

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

Параметры

mixed $value
string $type

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

$this

Исключения

InvalidArgumentException

mixed castBinding(mixed $value)

Преобразовать заданное значение привязки.

Параметры

mixed $value

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

mixed

$this mergeBindings(Builder $query)

Объединить массив привязок в наши привязки.

Параметры

Builder $query

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

$this

array cleanBindings(array $bindings)

Удалить все выражения из списка привязок.

Параметры

array $bindings

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

array

protected mixed flattenValue(mixed $value)

Получить значение скалярного типа из входных данных неизвестного типа.

Параметры

mixed $value

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

mixed

protected string defaultKeyName()

Получить имя ключевого поля по умолчанию для таблицы.

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

string

ConnectionInterface getConnection()

Получить экземпляр подключения к базе данных.

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

ConnectionInterface

Processor getProcessor()

Получить экземпляр обработчика запросов базы данных.

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

Processor

Grammar getGrammar()

Получить экземпляр синтаксического анализатора запросов.

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

Grammar

$this useWritePdo()

Использовать соединение PDO "write" при выполнении запроса.

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

$this

protected bool isQueryable(mixed $value)

Определить, является ли значение экземпляром билдера запросов или замыканием.

Параметры

mixed $value

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

bool

Builder clone()

Клонировать запрос.

Значение возврата

Builder

Builder cloneWithout(array $properties)

Клонировать запрос без указанных свойств.

Параметры

array $properties

Значение возврата

Builder

Builder cloneWithoutBindings(array $except)

Клонировать запрос без указанных связываний.

Параметры

array $except

Значение возврата

Builder

$this dump(mixed ...$args)

Вывести текущую SQL-строку и связывающие данные.

Параметры

mixed ...$args

Значение возврата

$this

$this dumpRawSql()

Вывести исходную SQL-строку с вложенными связывающими данными.

Значение возврата

$this

never dd()

Прекратить выполнение и вывести текущую SQL-строку и связывающие данные.

Значение возврата

never

never ddRawSql()

Прекратить выполнение и вывести текущую SQL-строку с вложенными связывающими данными.

Значение возврата

never

$this on(Closure|Expression|string $first, string|null $operator = null, Expression|string|null $second = null, string $boolean = 'and')

Добавить условие "on" к соединению.

Условие "on" может быть цепочным, например:

$join->on('contacts.user_id', '=', 'users.id') ->on('contacts.info_id', '=', 'info.id')

что приведет к следующей SQL-строке:

on contacts.user_id = users.id and contacts.info_id = info.id

Параметры

Closure|Expression|string $first
string|null $operator
Expression|string|null $second
string $boolean

Значение возврата

$this

Исключения

InvalidArgumentException

JoinClause orOn(Closure|Expression|string $first, string|null $operator = null, Expression|string|null $second = null)

Добавить условие "или на" к объединению.

Параметры

Closure|Expression|string $first
string|null $operator
Expression|string|null $second

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

JoinClause

protected Builder newParentQuery()

Создать новый экземпляр родительского запроса.

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

Builder

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/11.x/Illuminate/Database/Query/JoinClause.html

Spec-Zone.ru

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