Spec-Zone.ru › Laravel 8

BuildsQueries

trait BuildsQueries (View source)

Traits

Conditionable

Methods

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

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

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

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

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

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

Collection 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 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)

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

Model|object|BuildsQueries|null first(array|string $columns = ['*'])

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

Model|object|BuildsQueries|null sole(array|string $columns = ['*'])

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

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

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

string getOriginalColumnNameForCursorPagination(Builder|Builder $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|mixed tap(callable $callback)

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

Details

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

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

Parameters

mixed $value
callable $callback
callable|null $default

Return Value

$this|mixed

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

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

Parameters

mixed $value
callable $callback
callable|null $default

Return Value

$this|mixed

bool chunk(int $count, callable $callback)

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

Parameters

int $count
callable $callback

Return Value

bool

Collection chunkMap(callable $callback, int $count = 1000)

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

Parameters

callable $callback
int $count

Return Value

Collection

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

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

Parameters

callable $callback
int $count

Return Value

bool

Exceptions

RuntimeException
END_OF_DOCUMENT_MARKER

bool chunkById(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 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)

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

Параметры

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

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

LazyCollection

Исключения

InvalidArgumentException

Model|object|BuildsQueries|null first(array|string $columns = ['*'])

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

Параметры

array|string $columns

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

Model|object|BuildsQueries|null

Model|object|BuildsQueries|null sole(array|string $columns = ['*'])

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

Параметры

array|string $columns

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

Model|object|BuildsQueries|null

Исключения

RecordsNotFoundException
MultipleRecordsFoundException

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

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

Параметры

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

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

CursorPaginator

protected string getOriginalColumnNameForCursorPagination(Builder|Builder $builder, string $parameter)

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

Параметры

Builder|Builder $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
END_OF_DOCUMENT_MARKER

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|mixed tap(callable $callback)

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

Параметры

callable $callback

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

$this|mixed

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

Spec-Zone.ru

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