Laravel Collection Public API: collapse
The collapse method is used to combine all the first-level items of a collection into a new, single collection. It does not recursively collapse inner arrays. When called, it returns an instance of the Collection class. The collapse method can be particularly useful when working with nested arrays or collections.