Skip to content

Instantly share code, notes, and snippets.

View dani0332's full-sized avatar
I may be slow to respond.

Daniyal Nasir dani0332

I may be slow to respond.
  • ARPATech Pvt. Ltd
  • Pakistan
View GitHub Profile
dani0332 /
Created September 25, 2021 10:32 — forked from brunogaspar/
Recursive Laravel Collection Macros


If a nested array is passed into a Laravel Collection, by default these will be threaded as normal arrays.

However, that's not always the ideal case and it would be nice if we could have nested collections in a cleaner way.

This is where this macro comes in handy.