Showing 7 of 1,216 result(s)
count The count method is a straightforward method and simply returns the total number of items in the collection. The count method returns an integer.
diff($items) The diff method is used to determine which items in the collection are not present in the supplied $items collection. $items can be be either an array, or another instance of Collection . The diff method returns a new instance of...
diffKeys($items) The diffKeys method is similar to the diff method. It is used to determine which items whose keys in the collection are not present in the supplied $items collection's keys. $items can be either an array, or another instead of...
each(callable $callback) The each method accepts a $callback which will be called on each item in the collection. If the $callback returns false , the each method will break from its iterator and return a reference back to the original Collection...
filter(callable $callback = null) The filter method applies a filter to the collection. An optional $callback can be supplied to the filter method. If no $callback is supplied to the filter method, any value in the collection that evaluates to...
first(callable $callback = null, $default = null) The first method is used to get the first item in a collection, or to get the first item in a collection that matches a set of criteria. A $callback can be supplied to return the first item in the...
flatten The flatten method will return a new Collection instance representing a flattened version of the original collection's items. The flatten method internally makes use of the Illuminate\Support\Arr::flatten($array) helper method. The flatten...