Showing 7 of 1,216 result(s)
intersect($items) The intersect removes any values that are not in the provided $items array. The intersect method returns a new instance of Collection . The intersect method preserves any keys from the original collection. The following code...
isEmpty The isEmpty can be used to determine if the collection has items or not. If the collection has no items, true will be returned, otherwise false will be returned.
jsonSerialize The jsonSeralize method internally returns the value of the toArray method. This method exists to implement PHP's JsonSerializable interface, which allows developers to customize how a class is represented when using the json_encode...
keys The keys method is used to retrieve the keys of all items in the collection. The keys method returns a new Collection instance. The following code example demonstrates the usage of the keys method: After the above code executes, the $keys...
last(callable $callback = null, $default = null) The last method is the logical opposite of the first method, and is used to get the last item in a collection, or to get the last item in a collection that matches a certain criteria. A $callback...
lists($value, $key = null) The lists method is an alias of the pluck method. The lists method is used to retrieve the a list of values from the collection. It defines two parameters: $value and $key . The $value indicates which property should...
map(callable $callback) The map method applies a given $callback to each item in the collection. The $callback can modify the item which will be added to a new collection. The map method does not modify the original collection, but returns a new...