Showing 7 of 1,216 result(s)
take($limit) The take method is a useful method that will return a number of items (up to the provided $limit ) from the collection. If the $limit is negative, it will return a number of items (up to the provided $limit ) from the end of the...
toJson($options = 0) The toJson method will return a JSON encoded version of the data stored within the collection instance. It internally does this by returning a call to PHP's json_encode function, passing in any $options that were supplied....
transform(callable $callback) The transform is identical to the map method, but instead of returning a new Collection instance, the transform method will modify the original collection instance. The transform method will return a reference to the...
unique($key = null) The unique method can be used to get all the unique items in the collection. It accepts an option $key which can be used to further restrict which items are returned. The unique method returns a new instance of Collection with...
values The values method can be used to retrieve a new Collection instance containing only the values of the original collection instance. The keys of the new collection will be reset to consecutive numerical keys. The following example...
whereIn($key, array $values, $strict = true) The whereIn method is used to filter the collection based on a given $key and an array of the possible $values that the $key can have. The method also defines an optional $strict parameter, which when...
zip($items) The zip method is used to merge the values of the $items array with the values within the Collection at the corresponding index. The zip method produces results that are similar to Python's zip function, and developer's coming from a...