Laravel Collections or Foreach? Shorter? More Readable?

I want to raise a discussion. Laravel Collections allow you to avoid writing loops, also chaining the methods to make the code shorter. But is it really better or more readable? Let’s discuss this. Resources mentioned: – My original tweet:…

Laravel Collections or Foreach? Shorter? More Readable?

Source

0
(0)

I want to raise a discussion. Laravel Collections allow you to avoid writing loops, also chaining the methods to make the code shorter. But is it really better or more readable? Let’s discuss this.

Resources mentioned:
– My original tweet: https://twitter.com/PovilasKorop/status/1257023194239766534/photo/1
– Adam Wathan’s book “Refactoring to Collections”: https://adamwathan.me/refactoring-to-collections/
– Christoph Rumpel “How I refactor to collections”: https://christoph-rumpel.com/2016/11/How-I-refactor-to-collections/
– Diaa Fares “Review: Refactoring to Collections” https://laravel-news.com/review-refactoring-to-collections
– Brent “Arrow functions in PHP 7.4”: https://stitcher.io/blog/short-closures-in-php
– Matt Stauffer “Laravel Collections’ higher order messaging and “when” method in Laravel 5.4″: https://mattstauffer.com/blog/laravel-collections-higher-order-messaging-and-when-method-in-laravel-5-4/

– – – – –
Try our Laravel QuickAdminPanel: https://bit.ly/quickadminpanel
Enroll in my Laravel courses: https://laraveldaily.teachable.com

0 / 5. 0