Collections are fantastic features of the framework. With the functionality that the collection offers, we can easily handle any need that a dataset requires. But still, in some cases, we may extend with custom functionality.
Ever wanted a piece of functionality in a part of Laravel that doesn’t exist? Let me introduce you to Laravel macros. Macros allow you to add on custom functionality to internal Laravel components.
A set of useful Laravel collection macros.