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
  • 05:25 (UTC +05:00)
  • LinkedIn in/dani0332
View GitHub Profile
@dani0332
dani0332 / macro.md
Created September 25, 2021 10:32 — forked from brunogaspar/macro.md
Recursive Laravel Collection Macros

What?

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.

Setup