This is a list of Collection methods, ordered by purpose, instead of just an alphabetical order.
This allows you to quickly find the methods for the action you want to do, instead of checking the list one by one.
These methods create a new collection.
These methods return all or part of the collection in different ways.
- all
- dd
- dump
- duplicates
- duplicatesStrict
- except
- filter
- first
- firstWhere
- forPage
- get
- keys
- only
- last
- nth
- pluck
- random
- search
- take
- toArray
- toJson
- unique
- uniqueStrict
- unwrap
- where
- whereStrict
- whereBetween
- whereIn
- whereInStrict
- whereInstanceOf
- whereNotBetween
- whereNotIn
- whereNotInStrict
These methods traverse into all or part of the items to do some logic over them.
- each
- eachSpread
- flatMap
- map
- mapInto
- mapSpread
- mapToGroups
- mapWithKeys
- tap
- transform
- unless
- unlessEmpty
- unlessNotEmpty
- when
- whenEmpty
- whenNotEmpty
These methods manipulate the collection or its items. Most of them return a new modified collection.
- concat
- combine
- crossJoin
- diff
- diffAssoc
- diffKeys
- intersect
- intersectByKeys
- merge
- mergeRecursive
- union
- zip
- collapse
- flatten
- flip
- groupBy
- implode
- join
- keyBy
- pad
- replace
- replaceRecursive
- reverse
- shuffle
- sort
- sortBy
- sortByDesc
- sortKeys
- sortKeysDesc
- values
- wrap
These methods returns the result of a calculation or callback over the collection items.
These methods returns a boolean depending on the given truth test