Spec-Zone.ru › Laravel 11

BuildsQueries

trait BuildsQueries mixin Builder mixin Builder (View source)

Свойства

Conditionable

Методы

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

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

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

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

from Conditionable
bool chunk(int $count, callable $callback)

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

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

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

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

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

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

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

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

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

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

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

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

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

LazyCollection lazy(int $chunkSize = 1000)

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

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

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

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

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

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

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

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

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

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

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

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

Разбить запрос на страницы с помощью кусочного пагинатора.

string getOriginalColumnNameForCursorPagination($builder, string $parameter)

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

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

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

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

Создать новый простой пагинатор.

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

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

$this tap($callback)

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

Подробности

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

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

Parameters

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

Return Value

$this|TWhenReturnType

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

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

Parameters

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

Return Value

$this|TUnlessReturnType

bool chunk(int $count, callable $callback)

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

Parameters

int $count
callable $callback

Return Value

bool

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

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

Parameters

callable $callback
int $count

Return Value

TReturn>

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

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

Parameters

callable $callback
int $count

Return Value

bool

Exceptions

RuntimeException

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

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

Parameters

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

Return Value

bool

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

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

Parameters

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

Return Value

bool

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

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

Parameters

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

Return Value

bool

Exceptions

RuntimeException

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

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

Parameters

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

Return Value

bool

LazyCollection lazy(int $chunkSize = 1000)

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

Parameters

int $chunkSize

Return Value

LazyCollection

Exceptions

InvalidArgumentException

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

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

Parameters

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

Return Value

LazyCollection

Exceptions

InvalidArgumentException

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

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

Parameters

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

Return Value

LazyCollection

Exceptions

InvalidArgumentException

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

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

Parameters

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

Return Value

LazyCollection

Exceptions

InvalidArgumentException

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

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

Parameters

array|string $columns

Return Value

TValue|null

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

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

Parameters

array|string $columns

Return Value

TValue

Exceptions

RecordsNotFoundException
MultipleRecordsFoundException

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

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

Parameters

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

Return Value

CursorPaginator

protected string getOriginalColumnNameForCursorPagination($builder, string $parameter)

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

Parameters

$builder
string $parameter

Return Value

string
END_OF_DOCUMENT_MARKER

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

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

Spec-Zone.ru

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