Collection
extends Collection
in package
Proxy class.
Table of Contents
- $items : array<string|int, mixed>
- The items contained in the collection.
- $macros : array<string|int, mixed>
- The registered string macros.
- $proxies : array<string|int, mixed>
- The methods that can be proxied.
- __call() : mixed
- Dynamically handle calls to the class.
- __callStatic() : mixed
- Dynamically handle calls to the class.
- __construct() : void
- Create a new collection.
- __get() : mixed
- Dynamically access collection proxies.
- __toString() : string
- Convert the collection to its string representation.
- all() : array<string|int, mixed>
- Get all of the items in the collection.
- average() : mixed
- Alias for the "avg" method.
- avg() : mixed
- Get the average value of a given key.
- chunk() : static
- Chunk the underlying collection array.
- collapse() : static
- Collapse the collection of items into a single array.
- combine() : static
- Create a collection by using this collection for keys and another for its values.
- concat() : $this
- Push all of the given items onto the collection.
- contains() : bool
- Determine if an item exists in the collection.
- containsStrict() : bool
- Determine if an item exists in the collection using strict comparison.
- count() : int
- Count the number of items in the collection.
- crossJoin() : static
- Cross join with the given lists, returning all possible permutations.
- dd() : void
- Dump the collection and end the script.
- diff() : static
- Get the items in the collection that are not present in the given items.
- diffAssoc() : static
- Get the items in the collection whose keys and values are not present in the given items.
- diffKeys() : static
- Get the items in the collection whose keys are not present in the given items.
- dump() : $this
- Dump the collection.
- each() : $this
- Execute a callback over each item.
- eachSpread() : static
- Execute a callback over each nested chunk of items.
- every() : bool
- Determine if all items in the collection pass the given test.
- except() : static
- Get all items except for those with the specified keys.
- filter() : static
- Run a filter over each of the items.
- first() : mixed
- Get the first item from the collection.
- firstWhere() : static
- Get the first item by the given key value pair.
- flatMap() : static
- Map a collection and flatten the result by a single level.
- flatten() : static
- Get a flattened array of the items in the collection.
- flip() : static
- Flip the items in the collection.
- forget() : $this
- Remove an item from the collection by key.
- forPage() : static
- "Paginate" the collection by slicing it into a smaller collection.
- get() : mixed
- Get an item from the collection by key.
- getCachingIterator() : CachingIterator
- Get a CachingIterator instance.
- getIterator() : ArrayIterator
- Get an iterator for the items.
- groupBy() : static
- Group an associative array by a field or using a callback.
- has() : bool
- Determine if an item exists in the collection by key.
- hasMacro() : bool
- Checks if macro is registered.
- implode() : string
- Concatenate values of a given key as a string.
- intersect() : static
- Intersect the collection with the given items.
- intersectByKeys() : static
- Intersect the collection with the given items by key.
- isEmpty() : bool
- Determine if the collection is empty or not.
- isNotEmpty() : bool
- Determine if the collection is not empty.
- jsonSerialize() : array<string|int, mixed>
- Convert the object into something JSON serializable.
- keyBy() : static
- Key an associative array by a field or using a callback.
- keys() : static
- Get the keys of the collection items.
- last() : mixed
- Get the last item from the collection.
- lists() : array<string|int, mixed>
- Get an array with the values of a given key.
- macro() : void
- Register a custom macro.
- make() : static
- Create a new collection instance if the value isn't one already.
- map() : static
- Run a map over each of the items.
- mapInto() : static
- Map the values into a new class.
- mapSpread() : static
- Run a map over each nested chunk of items.
- mapToDictionary() : static
- Run a dictionary map over the items.
- mapToGroups() : static
- Run a grouping map over the items.
- mapWithKeys() : static
- Run an associative map over each of the items.
- max() : mixed
- Get the max value of a given key.
- median() : mixed
- Get the median of a given key.
- merge() : static
- Merge the collection with the given items.
- min() : mixed
- Get the min value of a given key.
- mixin() : void
- Mix another object into the class.
- mode() : array<string|int, mixed>|null
- Get the mode of a given key.
- nth() : static
- Create a new collection consisting of every n-th element.
- offsetExists() : bool
- Determine if an item exists at an offset.
- offsetGet() : mixed
- Get an item at a given offset.
- offsetSet() : void
- Set the item at a given offset.
- offsetUnset() : void
- Unset the item at a given offset.
- only() : static
- Get the items with the specified keys.
- pad() : static
- Pad collection to the specified length with a value.
- partition() : static
- Partition the collection into two arrays using the given callback or key.
- pipe() : mixed
- Pass the collection to the given callback and return the result.
- pluck() : static
- Get the values of a given key.
- pop() : mixed
- Get and remove the last item from the collection.
- prepend() : $this
- Push an item onto the beginning of the collection.
- proxy() : void
- Add a method to the list of proxied methods.
- pull() : mixed
- Get and remove an item from the collection.
- push() : $this
- Push an item onto the end of the collection.
- put() : $this
- Put an item in the collection by key.
- random() : mixed
- Get one or a specified number of items randomly from the collection.
- reduce() : mixed
- Reduce the collection to a single value.
- reject() : static
- Create a collection of all elements that do not pass a given truth test.
- reverse() : static
- Reverse items order.
- search() : mixed
- Search the collection for a given value and return the corresponding key if successful.
- shift() : mixed
- Get and remove the first item from the collection.
- shuffle() : static
- Shuffle the items in the collection.
- slice() : static
- Slice the underlying collection array.
- sort() : static
- Sort through each item with a callback.
- sortBy() : static
- Sort the collection using the given callback.
- sortByDesc() : static
- Sort the collection in descending order using the given callback.
- splice() : static
- Splice a portion of the underlying collection array.
- split() : static
- Split a collection into a certain number of groups.
- sum() : mixed
- Get the sum of the given values.
- take() : static
- Take the first or last {$limit} items.
- tap() : $this
- Pass the collection to the given callback and then return it.
- times() : static
- Create a new collection by invoking the callback a given amount of times.
- toArray() : array<string|int, mixed>
- Get the collection of items as a plain array.
- toBase() : Collection
- Get a base Support collection instance from this collection.
- toJson() : string
- Get the collection of items as JSON.
- transform() : $this
- Transform each item in the collection using a callback.
- union() : static
- Union the collection with the given items.
- unique() : static
- Return only unique items from the collection array.
- uniqueStrict() : static
- Return only unique items from the collection array using strict comparison.
- unless() : mixed
- Apply the callback if the value is falsy.
- unwrap() : array<string|int, mixed>
- Get the underlying items from the given collection if applicable.
- values() : static
- Reset the keys on the underlying array.
- when() : mixed
- Apply the callback if the value is truthy.
- where() : static
- Filter items by the given key value pair.
- whereIn() : static
- Filter items by the given key value pair.
- whereInStrict() : static
- Filter items by the given key value pair using strict comparison.
- whereNotIn() : static
- Filter items by the given key value pair.
- whereNotInStrict() : static
- Filter items by the given key value pair using strict comparison.
- whereStrict() : static
- Filter items by the given key value pair using strict comparison.
- wrap() : static
- Wrap the given value in a collection if applicable.
- zip() : static
- Zip the collection together with one or more arrays.
- getArrayableItems() : array<string|int, mixed>
- Results array of items from Collection or Arrayable.
- operatorForWhere() : Closure
- Get an operator checker callback.
- useAsCallable() : bool
- Determine if the given value is callable, but not a string.
- valueRetriever() : callable
- Get a value retrieving callback.
Properties
$items
The items contained in the collection.
protected
array<string|int, mixed>
$items
= []
$macros
The registered string macros.
protected
static array<string|int, mixed>
$macros
= []
$proxies
The methods that can be proxied.
protected
static array<string|int, mixed>
$proxies
= ['average', 'avg', 'contains', 'each', 'every', 'filter', 'first', 'flatMap', 'keyBy', 'map', 'partition', 'reject', 'sortBy', 'sortByDesc', 'sum', 'unique']
Methods
__call()
Dynamically handle calls to the class.
public
__call(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $method : string
- $parameters : array<string|int, mixed>
Tags
Return values
mixed —__callStatic()
Dynamically handle calls to the class.
public
static __callStatic(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $method : string
- $parameters : array<string|int, mixed>
Tags
Return values
mixed —__construct()
Create a new collection.
public
__construct([mixed $items = [] ]) : void
Parameters
- $items : mixed = []
Return values
void —__get()
Dynamically access collection proxies.
public
__get(string $key) : mixed
Parameters
- $key : string
Tags
Return values
mixed —__toString()
Convert the collection to its string representation.
public
__toString() : string
Return values
string —all()
Get all of the items in the collection.
public
all() : array<string|int, mixed>
Return values
array<string|int, mixed> —average()
Alias for the "avg" method.
public
average([callable|string|null $callback = null ]) : mixed
Parameters
- $callback : callable|string|null = null
Return values
mixed —avg()
Get the average value of a given key.
public
avg([callable|string|null $callback = null ]) : mixed
Parameters
- $callback : callable|string|null = null
Return values
mixed —chunk()
Chunk the underlying collection array.
public
chunk(int $size) : static
Parameters
- $size : int
Return values
static —collapse()
Collapse the collection of items into a single array.
public
collapse() : static
Return values
static —combine()
Create a collection by using this collection for keys and another for its values.
public
combine(mixed $values) : static
Parameters
- $values : mixed
Return values
static —concat()
Push all of the given items onto the collection.
public
concat(Traversable $source) : $this
Parameters
- $source : Traversable
Return values
$this —contains()
Determine if an item exists in the collection.
public
contains(mixed $key[, mixed $operator = null ][, mixed $value = null ]) : bool
Parameters
- $key : mixed
- $operator : mixed = null
- $value : mixed = null
Return values
bool —containsStrict()
Determine if an item exists in the collection using strict comparison.
public
containsStrict(mixed $key[, mixed $value = null ]) : bool
Parameters
- $key : mixed
- $value : mixed = null
Return values
bool —count()
Count the number of items in the collection.
public
count() : int
Return values
int —crossJoin()
Cross join with the given lists, returning all possible permutations.
public
crossJoin(mixed ...$lists) : static
Parameters
- $lists : mixed
Return values
static —dd()
Dump the collection and end the script.
public
dd(mixed ...$args) : void
Parameters
- $args : mixed
Return values
void —diff()
Get the items in the collection that are not present in the given items.
public
diff(mixed $items) : static
Parameters
- $items : mixed
Return values
static —diffAssoc()
Get the items in the collection whose keys and values are not present in the given items.
public
diffAssoc(mixed $items) : static
Parameters
- $items : mixed
Return values
static —diffKeys()
Get the items in the collection whose keys are not present in the given items.
public
diffKeys(mixed $items) : static
Parameters
- $items : mixed
Return values
static —dump()
Dump the collection.
public
dump() : $this
Return values
$this —each()
Execute a callback over each item.
public
each(callable $callback) : $this
Parameters
- $callback : callable
Return values
$this —eachSpread()
Execute a callback over each nested chunk of items.
public
eachSpread(callable $callback) : static
Parameters
- $callback : callable
Return values
static —every()
Determine if all items in the collection pass the given test.
public
every(string|callable $key[, mixed $operator = null ][, mixed $value = null ]) : bool
Parameters
- $key : string|callable
- $operator : mixed = null
- $value : mixed = null
Return values
bool —except()
Get all items except for those with the specified keys.
public
except(Collection|mixed $keys) : static
Parameters
- $keys : Collection|mixed
Return values
static —filter()
Run a filter over each of the items.
public
filter([callable|null $callback = null ]) : static
Parameters
- $callback : callable|null = null
Return values
static —first()
Get the first item from the collection.
public
first([callable|null $callback = null ][, mixed $default = null ]) : mixed
Parameters
- $callback : callable|null = null
- $default : mixed = null
Return values
mixed —firstWhere()
Get the first item by the given key value pair.
public
firstWhere(string $key, mixed $operator[, mixed $value = null ]) : static
Parameters
- $key : string
- $operator : mixed
- $value : mixed = null
Return values
static —flatMap()
Map a collection and flatten the result by a single level.
public
flatMap(callable $callback) : static
Parameters
- $callback : callable
Return values
static —flatten()
Get a flattened array of the items in the collection.
public
flatten([int $depth = INF ]) : static
Parameters
- $depth : int = INF
Return values
static —flip()
Flip the items in the collection.
public
flip() : static
Return values
static —forget()
Remove an item from the collection by key.
public
forget(string|array<string|int, mixed> $keys) : $this
Parameters
- $keys : string|array<string|int, mixed>
Return values
$this —forPage()
"Paginate" the collection by slicing it into a smaller collection.
public
forPage(int $page, int $perPage) : static
Parameters
- $page : int
- $perPage : int
Return values
static —get()
Get an item from the collection by key.
public
get(mixed $key[, mixed $default = null ]) : mixed
Parameters
- $key : mixed
- $default : mixed = null
Return values
mixed —getCachingIterator()
Get a CachingIterator instance.
public
getCachingIterator([int $flags = CachingIterator::CALL_TOSTRING ]) : CachingIterator
Parameters
- $flags : int = CachingIterator::CALL_TOSTRING
Return values
CachingIterator —getIterator()
Get an iterator for the items.
public
getIterator() : ArrayIterator
Return values
ArrayIterator —groupBy()
Group an associative array by a field or using a callback.
public
groupBy(callable|string $groupBy[, bool $preserveKeys = false ]) : static
Parameters
- $groupBy : callable|string
- $preserveKeys : bool = false
Return values
static —has()
Determine if an item exists in the collection by key.
public
has(mixed $key) : bool
Parameters
- $key : mixed
Return values
bool —hasMacro()
Checks if macro is registered.
public
static hasMacro(string $name) : bool
Parameters
- $name : string
Return values
bool —implode()
Concatenate values of a given key as a string.
public
implode(string $value[, string $glue = null ]) : string
Parameters
- $value : string
- $glue : string = null
Return values
string —intersect()
Intersect the collection with the given items.
public
intersect(mixed $items) : static
Parameters
- $items : mixed
Return values
static —intersectByKeys()
Intersect the collection with the given items by key.
public
intersectByKeys(mixed $items) : static
Parameters
- $items : mixed
Return values
static —isEmpty()
Determine if the collection is empty or not.
public
isEmpty() : bool
Return values
bool —isNotEmpty()
Determine if the collection is not empty.
public
isNotEmpty() : bool
Return values
bool —jsonSerialize()
Convert the object into something JSON serializable.
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —keyBy()
Key an associative array by a field or using a callback.
public
keyBy(callable|string $keyBy) : static
Parameters
- $keyBy : callable|string
Return values
static —keys()
Get the keys of the collection items.
public
keys() : static
Return values
static —last()
Get the last item from the collection.
public
last([callable|null $callback = null ][, mixed $default = null ]) : mixed
Parameters
- $callback : callable|null = null
- $default : mixed = null
Return values
mixed —lists()
Get an array with the values of a given key.
public
lists(string $value[, string $key = null ]) : array<string|int, mixed>
Parameters
- $value : string
- $key : string = null
Return values
array<string|int, mixed> —macro()
Register a custom macro.
public
static macro(string $name, object|callable $macro) : void
Parameters
- $name : string
- $macro : object|callable
Return values
void —make()
Create a new collection instance if the value isn't one already.
public
static make([mixed $items = [] ]) : static
Parameters
- $items : mixed = []
Return values
static —map()
Run a map over each of the items.
public
map(callable $callback) : static
Parameters
- $callback : callable
Return values
static —mapInto()
Map the values into a new class.
public
mapInto(string $class) : static
Parameters
- $class : string
Return values
static —mapSpread()
Run a map over each nested chunk of items.
public
mapSpread(callable $callback) : static
Parameters
- $callback : callable
Return values
static —mapToDictionary()
Run a dictionary map over the items.
public
mapToDictionary(callable $callback) : static
The callback should return an associative array with a single key/value pair.
Parameters
- $callback : callable
Return values
static —mapToGroups()
Run a grouping map over the items.
public
mapToGroups(callable $callback) : static
The callback should return an associative array with a single key/value pair.
Parameters
- $callback : callable
Return values
static —mapWithKeys()
Run an associative map over each of the items.
public
mapWithKeys(callable $callback) : static
The callback should return an associative array with a single key/value pair.
Parameters
- $callback : callable
Return values
static —max()
Get the max value of a given key.
public
max([callable|string|null $callback = null ]) : mixed
Parameters
- $callback : callable|string|null = null
Return values
mixed —median()
Get the median of a given key.
public
median([null $key = null ]) : mixed
Parameters
- $key : null = null
Return values
mixed —merge()
Merge the collection with the given items.
public
merge(mixed $items) : static
Parameters
- $items : mixed
Return values
static —min()
Get the min value of a given key.
public
min([callable|string|null $callback = null ]) : mixed
Parameters
- $callback : callable|string|null = null
Return values
mixed —mixin()
Mix another object into the class.
public
static mixin(object $mixin) : void
Parameters
- $mixin : object
Return values
void —mode()
Get the mode of a given key.
public
mode([mixed $key = null ]) : array<string|int, mixed>|null
Parameters
- $key : mixed = null
Return values
array<string|int, mixed>|null —nth()
Create a new collection consisting of every n-th element.
public
nth(int $step, int $offset) : static
Parameters
- $step : int
- $offset : int
Return values
static —offsetExists()
Determine if an item exists at an offset.
public
offsetExists(mixed $key) : bool
Parameters
- $key : mixed
Return values
bool —offsetGet()
Get an item at a given offset.
public
offsetGet(mixed $key) : mixed
Parameters
- $key : mixed
Return values
mixed —offsetSet()
Set the item at a given offset.
public
offsetSet(mixed $key, mixed $value) : void
Parameters
- $key : mixed
- $value : mixed
Return values
void —offsetUnset()
Unset the item at a given offset.
public
offsetUnset(string $key) : void
Parameters
- $key : string
Return values
void —only()
Get the items with the specified keys.
public
only(mixed $keys) : static
Parameters
- $keys : mixed
Return values
static —pad()
Pad collection to the specified length with a value.
public
pad(int $size, mixed $value) : static
Parameters
- $size : int
- $value : mixed
Return values
static —partition()
Partition the collection into two arrays using the given callback or key.
public
partition(callable|string $callback) : static
Parameters
- $callback : callable|string
Return values
static —pipe()
Pass the collection to the given callback and return the result.
public
pipe(callable $callback) : mixed
Parameters
- $callback : callable
Return values
mixed —pluck()
Get the values of a given key.
public
pluck(string|array<string|int, mixed> $value[, string|null $key = null ]) : static
Parameters
- $value : string|array<string|int, mixed>
- $key : string|null = null
Return values
static —pop()
Get and remove the last item from the collection.
public
pop() : mixed
Return values
mixed —prepend()
Push an item onto the beginning of the collection.
public
prepend(mixed $value[, mixed $key = null ]) : $this
Parameters
- $value : mixed
- $key : mixed = null
Return values
$this —proxy()
Add a method to the list of proxied methods.
public
static proxy(string $method) : void
Parameters
- $method : string
Return values
void —pull()
Get and remove an item from the collection.
public
pull(mixed $key[, mixed $default = null ]) : mixed
Parameters
- $key : mixed
- $default : mixed = null
Return values
mixed —push()
Push an item onto the end of the collection.
public
push(mixed $value) : $this
Parameters
- $value : mixed
Return values
$this —put()
Put an item in the collection by key.
public
put(mixed $key, mixed $value) : $this
Parameters
- $key : mixed
- $value : mixed
Return values
$this —random()
Get one or a specified number of items randomly from the collection.
public
random([int|null $number = null ]) : mixed
Parameters
- $number : int|null = null
Tags
Return values
mixed —reduce()
Reduce the collection to a single value.
public
reduce(callable $callback[, mixed $initial = null ]) : mixed
Parameters
- $callback : callable
- $initial : mixed = null
Return values
mixed —reject()
Create a collection of all elements that do not pass a given truth test.
public
reject(callable|mixed $callback) : static
Parameters
- $callback : callable|mixed
Return values
static —reverse()
Reverse items order.
public
reverse() : static
Return values
static —search()
Search the collection for a given value and return the corresponding key if successful.
public
search(mixed $value[, bool $strict = false ]) : mixed
Parameters
- $value : mixed
- $strict : bool = false
Return values
mixed —shift()
Get and remove the first item from the collection.
public
shift() : mixed
Return values
mixed —shuffle()
Shuffle the items in the collection.
public
shuffle([int $seed = null ]) : static
Parameters
- $seed : int = null
Return values
static —slice()
Slice the underlying collection array.
public
slice(int $offset[, int $length = null ]) : static
Parameters
- $offset : int
- $length : int = null
Return values
static —sort()
Sort through each item with a callback.
public
sort([callable|null $callback = null ]) : static
Parameters
- $callback : callable|null = null
Return values
static —sortBy()
Sort the collection using the given callback.
public
sortBy(callable|string $callback[, int $options = SORT_REGULAR ][, bool $descending = false ]) : static
Parameters
- $callback : callable|string
- $options : int = SORT_REGULAR
- $descending : bool = false
Return values
static —sortByDesc()
Sort the collection in descending order using the given callback.
public
sortByDesc(callable|string $callback[, int $options = SORT_REGULAR ]) : static
Parameters
- $callback : callable|string
- $options : int = SORT_REGULAR
Return values
static —splice()
Splice a portion of the underlying collection array.
public
splice(int $offset[, int|null $length = null ][, mixed $replacement = [] ]) : static
Parameters
- $offset : int
- $length : int|null = null
- $replacement : mixed = []
Return values
static —split()
Split a collection into a certain number of groups.
public
split(int $numberOfGroups) : static
Parameters
- $numberOfGroups : int
Return values
static —sum()
Get the sum of the given values.
public
sum([callable|string|null $callback = null ]) : mixed
Parameters
- $callback : callable|string|null = null
Return values
mixed —take()
Take the first or last {$limit} items.
public
take(int $limit) : static
Parameters
- $limit : int
Return values
static —tap()
Pass the collection to the given callback and then return it.
public
tap(callable $callback) : $this
Parameters
- $callback : callable
Return values
$this —times()
Create a new collection by invoking the callback a given amount of times.
public
static times(int $number[, callable $callback = null ]) : static
Parameters
- $number : int
- $callback : callable = null
Return values
static —toArray()
Get the collection of items as a plain array.
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —toBase()
Get a base Support collection instance from this collection.
public
toBase() : Collection
Return values
Collection —toJson()
Get the collection of items as JSON.
public
toJson(int $options) : string
Parameters
- $options : int
Return values
string —transform()
Transform each item in the collection using a callback.
public
transform(callable $callback) : $this
Parameters
- $callback : callable
Return values
$this —union()
Union the collection with the given items.
public
union(mixed $items) : static
Parameters
- $items : mixed
Return values
static —unique()
Return only unique items from the collection array.
public
unique([string|callable|null $key = null ][, bool $strict = false ]) : static
Parameters
- $key : string|callable|null = null
- $strict : bool = false
Return values
static —uniqueStrict()
Return only unique items from the collection array using strict comparison.
public
uniqueStrict([string|callable|null $key = null ]) : static
Parameters
- $key : string|callable|null = null
Return values
static —unless()
Apply the callback if the value is falsy.
public
unless(bool $value, callable $callback[, callable $default = null ]) : mixed
Parameters
- $value : bool
- $callback : callable
- $default : callable = null
Return values
mixed —unwrap()
Get the underlying items from the given collection if applicable.
public
static unwrap(array<string|int, mixed>|static $value) : array<string|int, mixed>
Parameters
- $value : array<string|int, mixed>|static
Return values
array<string|int, mixed> —values()
Reset the keys on the underlying array.
public
values() : static
Return values
static —when()
Apply the callback if the value is truthy.
public
when(bool $value, callable $callback[, callable $default = null ]) : mixed
Parameters
- $value : bool
- $callback : callable
- $default : callable = null
Return values
mixed —where()
Filter items by the given key value pair.
public
where(string $key, mixed $operator[, mixed $value = null ]) : static
Parameters
- $key : string
- $operator : mixed
- $value : mixed = null
Return values
static —whereIn()
Filter items by the given key value pair.
public
whereIn(string $key, mixed $values[, bool $strict = false ]) : static
Parameters
- $key : string
- $values : mixed
- $strict : bool = false
Return values
static —whereInStrict()
Filter items by the given key value pair using strict comparison.
public
whereInStrict(string $key, mixed $values) : static
Parameters
- $key : string
- $values : mixed
Return values
static —whereNotIn()
Filter items by the given key value pair.
public
whereNotIn(string $key, mixed $values[, bool $strict = false ]) : static
Parameters
- $key : string
- $values : mixed
- $strict : bool = false
Return values
static —whereNotInStrict()
Filter items by the given key value pair using strict comparison.
public
whereNotInStrict(string $key, mixed $values) : static
Parameters
- $key : string
- $values : mixed
Return values
static —whereStrict()
Filter items by the given key value pair using strict comparison.
public
whereStrict(string $key, mixed $value) : static
Parameters
- $key : string
- $value : mixed
Return values
static —wrap()
Wrap the given value in a collection if applicable.
public
static wrap(mixed $value) : static
Parameters
- $value : mixed
Return values
static —zip()
Zip the collection together with one or more arrays.
public
zip(mixed ...$items) : static
e.g. new Collection([1, 2, 3])->zip([4, 5, 6]); => [[1, 4], [2, 5], [3, 6]]
Parameters
- $items : mixed
Return values
static —getArrayableItems()
Results array of items from Collection or Arrayable.
protected
getArrayableItems(mixed $items) : array<string|int, mixed>
Parameters
- $items : mixed
Return values
array<string|int, mixed> —operatorForWhere()
Get an operator checker callback.
protected
operatorForWhere(string $key, string $operator[, mixed $value = null ]) : Closure
Parameters
- $key : string
- $operator : string
- $value : mixed = null
Return values
Closure —useAsCallable()
Determine if the given value is callable, but not a string.
protected
useAsCallable(mixed $value) : bool
Parameters
- $value : mixed
Return values
bool —valueRetriever()
Get a value retrieving callback.
protected
valueRetriever(string $value) : callable
Parameters
- $value : string