EnumeratesValues
Properties
$escapeWhenCastingToString bool
Indicates that the object's string representation should be escaped when __toString is invoked.
$proxies string[]
The methods that can be proxied.
Methods
make ( $items ) : static
Create a new collection instance if the value isn't one already.
Parameters
- $items mixed
wrap ( $value ) : static
Wrap the given value in a collection if applicable.
Parameters
- $value mixed
unwrap ( $value ) : array
Get the underlying items from the given collection if applicable.
Parameters
- $value array|static
empty ( ) : static
Create a new instance with no items.
times ( $number , callable $callback ) : static
Create a new collection by invoking the callback a given amount of times.
Parameters
- $number int
- $callback callable|null
average ( $callback ) : mixed
Alias for the "avg" method.
Parameters
- $callback callable|string|null
some ( $key , $operator , $value ) : bool
Alias for the "contains" method.
Parameters
- $key mixed
- $operator mixed
- $value mixed
containsStrict ( $key , $value ) : bool
Determine if an item exists, using strict comparison.
Parameters
- $key mixed
- $value mixed
dd ( $args ) : void
Dump the items and end the script.
Parameters
- $args mixed
dump ( ) : $this
Dump the items.
each ( callable $callback ) : $this
Execute a callback over each item.
Parameters
- $callback callable
eachSpread ( callable $callback ) : static
Execute a callback over each nested chunk of items.
Parameters
- $callback callable
every ( $key , $operator , $value ) : bool
Determine if all items pass the given truth test.
Parameters
- $key string|callable
- $operator mixed
- $value mixed
firstWhere ( $key , $operator , $value ) : mixed
Get the first item by the given key value pair.
Parameters
- $key string
- $operator mixed
- $value mixed
isNotEmpty ( ) : bool
Determine if the collection is not empty.
mapSpread ( callable $callback ) : static
Run a map over each nested chunk of items.
Parameters
- $callback callable
mapToGroups ( callable $callback ) : static
Run a grouping map over the items.
Parameters
- $callback callable
flatMap ( callable $callback ) : static
Map a collection and flatten the result by a single level.
Parameters
- $callback callable
mapInto ( $class ) : static
Map the values into a new class.
Parameters
- $class string
min ( $callback ) : mixed
Get the min value of a given key.
Parameters
- $callback callable|string|null
max ( $callback ) : mixed
Get the max value of a given key.
Parameters
- $callback callable|string|null
forPage ( $page , $perPage ) : static
"Paginate" the collection by slicing it into a smaller collection.
Parameters
- $page int
- $perPage int
partition ( $key , $operator , $value ) : static
Partition the collection into two arrays using the given callback or key.
Parameters
- $key callable|string
- $operator mixed
- $value mixed
sum ( $callback ) : mixed
Get the sum of the given values.
Parameters
- $callback callable|string|null
when ( $value , callable $callback , callable $default ) : static|mixed
Apply the callback if the value is truthy.
Parameters
- $value bool|mixed
- $callback callable|null
- $default callable|null
whenEmpty ( callable $callback , callable $default ) : static|mixed
Apply the callback if the collection is empty.
Parameters
- $callback callable
- $default callable|null
whenNotEmpty ( callable $callback , callable $default ) : static|mixed
Apply the callback if the collection is not empty.
Parameters
- $callback callable
- $default callable|null
unless ( $value , callable $callback , callable $default ) : static|mixed
Apply the callback if the value is falsy.
Parameters
- $value bool
- $callback callable
- $default callable|null
unlessEmpty ( callable $callback , callable $default ) : static|mixed
Apply the callback unless the collection is empty.
Parameters
- $callback callable
- $default callable|null
unlessNotEmpty ( callable $callback , callable $default ) : static|mixed
Apply the callback unless the collection is not empty.
Parameters
- $callback callable
- $default callable|null
where ( $key , $operator , $value ) : static
Filter items by the given key value pair.
Parameters
- $key string
- $operator mixed
- $value mixed
whereNull ( $key ) : static
Filter items where the value for the given key is null.
Parameters
- $key string|null
whereNotNull ( $key ) : static
Filter items where the value for the given key is not null.
Parameters
- $key string|null
whereStrict ( $key , $value ) : static
Filter items by the given key value pair using strict comparison.
Parameters
- $key string
- $value mixed
whereIn ( $key , $values , $strict ) : static
Filter items by the given key value pair.
Parameters
- $key string
- $values mixed
- $strict bool
whereInStrict ( $key , $values ) : static
Filter items by the given key value pair using strict comparison.
Parameters
- $key string
- $values mixed
whereBetween ( $key , $values ) : static
Filter items such that the value of the given key is between the given values.
Parameters
- $key string
- $values array
whereNotBetween ( $key , $values ) : static
Filter items such that the value of the given key is not between the given values.
Parameters
- $key string
- $values array
whereNotIn ( $key , $values , $strict ) : static
Filter items by the given key value pair.
Parameters
- $key string
- $values mixed
- $strict bool
whereNotInStrict ( $key , $values ) : static
Filter items by the given key value pair using strict comparison.
Parameters
- $key string
- $values mixed
whereInstanceOf ( $type ) : static
Filter the items, removing any items that don't match the given type(s).
Parameters
- $type string|string[]
pipe ( callable $callback ) : mixed
Pass the collection to the given callback and return the result.
Parameters
- $callback callable
pipeInto ( $class ) : mixed
Pass the collection into a new class.
Parameters
- $class string
pipeThrough ( $pipes ) : mixed
Pass the collection through a series of callable pipes and return the result.
Parameters
- $pipes callable[]
tap ( callable $callback ) : $this
Pass the collection to the given callback and then return it.
Parameters
- $callback callable
reduce ( callable $callback , $initial ) : mixed
Reduce the collection to a single value.
Parameters
- $callback callable
- $initial mixed
reduceMany ( callable $callback , $initial ) : array
Reduce the collection to multiple aggregate values.
Parameters
- $callback callable
- $initial mixed
reduceSpread ( callable $callback , $initial ) : array
Reduce the collection to multiple aggregate values.
Parameters
- $callback callable
- $initial mixed
reduceWithKeys ( callable $callback , $initial ) : mixed
Reduce an associative collection to a single value.
Parameters
- $callback callable
- $initial mixed
reject ( $callback ) : static
Create a collection of all elements that do not pass a given truth test.
Parameters
- $callback callable|mixed
uniqueStrict ( $key ) : static
Return only unique items from the collection array using strict comparison.
Parameters
- $key string|callable|null
toArray ( ) : array
Get the collection of items as a plain array.
jsonSerialize ( ) : array
Convert the object into something JSON serializable.
toJson ( $options ) : string
Get the collection of items as JSON.
Parameters
- $options int
getCachingIterator ( $flags ) : CachingIterator
Get a CachingIterator instance.
Parameters
- $flags int
__toString ( ) : string
Convert the collection to its string representation.
escapeWhenCastingToString ( $escape ) : $this
Indicate that the model's string representation should be escaped when __toString is invoked.
Parameters
- $escape bool
proxy ( $method ) : void
Add a method to the list of proxied methods.
Parameters
- $method string
__get ( $key ) : mixed
Dynamically access collection proxies.
Parameters
- $key string
getArrayableItems ( $items ) : array
Results array of items from Collection or Arrayable.
Parameters
- $items mixed
operatorForWhere ( $key , $operator , $value ) : Closure
Get an operator checker callback.
Parameters
- $key string
- $operator string|null
- $value mixed
useAsCallable ( $value ) : bool
Determine if the given value is callable, but not a string.
Parameters
- $value mixed
valueRetriever ( $value ) : callable
Get a value retrieving callback.
Parameters
- $value callable|string|null
equality ( $value ) : Closure
Make a function to check an item's equality.
Parameters
- $value mixed