BuildsQueries
trait BuildsQueries (View source)
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. | |
Model|object|BuildsQueries|null | first(array $columns = ['*']) Execute the query and get the first result. | |
mixed|$this | when(mixed $value, callable $callback, callable $default = null) Apply the callback's query changes if the given "value" is true. | |
Builder | tap(Closure $callback) Pass the query to a given callback. | |
mixed|$this | unless(mixed $value, callable $callback, callable $default = null) Apply the callback's query changes if the given "value" is false. | |
LengthAwarePaginator | paginator(Collection $items, int $total, int $perPage, int $currentPage, array $options) Create a new length-aware paginator instance. | |
Paginator | simplePaginator(Collection $items, int $perPage, int $currentPage, array $options) Create a new simple paginator instance. |
Details
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.
Model|object|BuildsQueries|null first(array $columns = ['*'])
Execute the query and get the first result.
mixed|$this when(mixed $value, callable $callback, callable $default = null)
Apply the callback's query changes if the given "value" is true.
mixed|$this unless(mixed $value, callable $callback, callable $default = null)
Apply the callback's query changes if the given "value" is false.
protected LengthAwarePaginator paginator(Collection $items, int $total, int $perPage, int $currentPage, array $options)
Create a new length-aware paginator instance.
protected Paginator simplePaginator(Collection $items, int $perPage, int $currentPage, array $options)
Create a new simple paginator instance.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.7/Illuminate/Database/Concerns/BuildsQueries.html