DEV Community

Discussion on: 7 Laravel Collection Methods You Might Not Know

Collapse
 
robinbastiaan profile image
Robin Bastiaan

Very nice collections methods a good Laravel programmer must be aware off. This is where collections shine over the use of plain arrays. Although when possible I like to filter and transform as much as possible in the Eloquent query itself of maximum performance.

One little suggestions on the 7th method: Partition. I would always use longer and self-describing variable names like $managers and $programmers in this example.

Thanks for the article!

Collapse
 
davidrjenni profile image
David

Thanks a lot for your feedback!

Although when possible I like to filter and transform as much as possible in the Eloquent query itself of maximum performance.

That's certainly a valuable tip. 👍

I would always use longer and self-describing variable names like $managers and $programmers in this example.

Definitively true. I just wanted to keep it short for better readability on smaller screens.