BuildsQueries
Methods
chunk ( $count , callable $callback ) : bool
Chunk the results of the query.
Parameters
- $count int
- $callback callable
chunkMap ( callable $callback , $count ) : Collection
Run a map over each item while chunking.
Parameters
- $callback callable
- $count int
each ( callable $callback , $count ) : bool
Execute a callback over each item while chunking.
Parameters
- $callback callable
- $count int
chunkById ( $count , callable $callback , $column , $alias ) : bool
Chunk the results of a query by comparing IDs.
Parameters
- $count int
- $callback callable
- $column string|null
- $alias string|null
eachById ( callable $callback , $count , $column , $alias ) : bool
Execute a callback over each item while chunking by ID.
Parameters
- $callback callable
- $count int
- $column string|null
- $alias string|null
lazy ( $chunkSize ) : LazyCollection
Query lazily, by chunks of the given size.
Parameters
- $chunkSize int
lazyById ( $chunkSize , $column , $alias ) : LazyCollection
Query lazily, by chunking the results of a query by comparing IDs.
Parameters
- $chunkSize int
- $column string|null
- $alias string|null
lazyByIdDesc ( $chunkSize , $column , $alias ) : LazyCollection
Query lazily, by chunking the results of a query by comparing IDs in descending order.
Parameters
- $chunkSize int
- $column string|null
- $alias string|null
orderedLazyById ( $chunkSize , $column , $alias , $descending ) : LazyCollection
Query lazily, by chunking the results of a query by comparing IDs in a given order.
Parameters
- $chunkSize int
- $column string|null
- $alias string|null
- $descending bool
first ( $columns ) : Model |object|static|null
Execute the query and get the first result.
Parameters
- $columns array|string
sole ( $columns ) : Model |object|static|null
Execute the query and get the first result if it's the sole matching record.
Parameters
- $columns array|string
paginateUsingCursor ( $perPage , $columns , $cursorName , $cursor ) : CursorPaginator
Paginate the given query using a cursor paginator.
Parameters
- $perPage int
- $columns array
- $cursorName string
- $cursor Cursor |string|null
getOriginalColumnNameForCursorPagination ( $builder , string $parameter ) : string
Get the original column name of the given column, without any aliasing.
Parameters
paginator ( $items , $total , $perPage , $currentPage , $options ) : LengthAwarePaginator
Create a new length-aware paginator instance.
Parameters
- $items Collection
- $total int
- $perPage int
- $currentPage int
- $options array
simplePaginator ( $items , $perPage , $currentPage , $options ) : Paginator
Create a new simple paginator instance.
Parameters
- $items Collection
- $perPage int
- $currentPage int
- $options array
cursorPaginator ( $items , $perPage , $cursor , $options ) : CursorPaginator
Create a new cursor paginator instance.
Parameters
- $items Collection
- $perPage int
- $cursor Cursor
- $options array
tap ( $callback ) : $this|mixed
Pass the query to a given callback.
Parameters
- $callback callable