trait BuildsQueries

Methods

bool
chunk(int $count, callable $callback)

Chunk the results of the query.

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

Execute a callback over each item while chunking.

first(array $columns = ['*'])

Execute the query and get the first result.

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

Apply the callback's query changes if the given "value" is true.

tap(Closure $callback)

Pass the query to a given callback.

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

Apply the callback's query changes if the given "value" is false.

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

Create a new length-aware paginator instance.

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

Create a new simple paginator instance.

Details

at line 18
bool chunk(int $count, callable $callback)

Chunk the results of the query.

Parameters

int $count
callable $callback

Return Value

bool

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

Execute a callback over each item while chunking.

Parameters

callable $callback
int $count

Return Value

bool

at line 73
Model|BuildsQueries|null first(array $columns = ['*'])

Execute the query and get the first result.

Parameters

array $columns

Return Value

Model|BuildsQueries|null

at line 86
mixed when(mixed $value, callable $callback, callable $default = null)

Apply the callback's query changes if the given "value" is true.

Parameters

mixed $value
callable $callback
callable $default

Return Value

mixed

at line 103
Builder tap(Closure $callback)

Pass the query to a given callback.

Parameters

Closure $callback

Return Value

Builder

at line 116
mixed unless(mixed $value, callable $callback, callable $default = null)

Apply the callback's query changes if the given "value" is false.

Parameters

mixed $value
callable $callback
callable $default

Return Value

mixed

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

Create a new length-aware paginator instance.

Parameters

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

Return Value

LengthAwarePaginator

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

Create a new simple paginator instance.

Parameters

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

Return Value

Paginator