Skip to content

Instantly share code, notes, and snippets.

@DarkGhostHunter
Last active December 19, 2023 08:23
Show Gist options
  • Save DarkGhostHunter/3817141e126d42b9ce8ce7151f665c19 to your computer and use it in GitHub Desktop.
Save DarkGhostHunter/3817141e126d42b9ce8ce7151f665c19 to your computer and use it in GitHub Desktop.
Laravel Collection Methods order by Purpose

Collection methods

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.



Creation

These methods create a new collection.

Retrieval

These methods return all or part of the collection in different ways.

Loops

These methods traverse into all or part of the items to do some logic over them.

Manipulation

These methods manipulate the collection or its items. Most of them return a new modified collection.

Addition

Removal

Separation

Combination

Modification

Calculation

These methods returns the result of a calculation or callback over the collection items.

Verification

These methods returns a boolean depending on the given truth test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment