Laravel Collections Chains: 15 Real Examples
July 2022 / 40 min / Laravel 9
Watch Video About the Course
Notice: if you're interested in more courses than just this one, the best deal is to subscribe to the Yearly membership!
Collections in Laravel are "hidden gems": everyone has heard of them, but not everyone is using them or even knows how to use them.
Especially they are effective when performing multiple operations with data - so-called "chains", and this course is specifically about that.
I've gathered 15 real-life examples from open-source Laravel projects. The goal is not only to show the Collection methods but also the practical scenarios of when they should be used.
In each example, we will trace down the intermediate values of the methods, so you will understand exactly how each method transforms the data.
There's a Github repository for you to play around with examples, and links to all the sources mentioned.
Your Instructor
I consider myself a Laravel expert. Work with Laravel for around 7 years, sharing my thoughts on the YouTube channel "Laravel Daily": https://www.youtube.com/c/LaravelDaily
I also have written a Laravel Daily Blog for 5+ years.
Course Curriculum
-
StartExample 5: push + map + implode (1:53)
-
StartExample 6: filter + map + implode (1:58)
-
StartExample 7: reject + reject + each (4:11)
-
StartExample 8: mapWithKeys + forget + filter (2:11)
-
StartExample 9: map + filter + each (2:01)
-
StartExample 10: map + filter + implode (2:08)
-
StartExample 11: filter + filter + each (1:53)