Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Matt Stauffer:
Advanced operations with Collection::where in Laravel 5.3
Jul 15, 2016 @ 16:35:44

Matt Stauffer has continued his series looking at new features in Laravel 5.3 with a look at advanced operations on collections, specifically related to the "where" handling.

If you want to filter a Laravel collection to only those records which meet particular criteria, you're most likely going to reach for filter() or reject(). [...] You might not know it, but there's also a where() method that's pretty simple that gives you the same functionality.

He points out the main difference in Laravel 5.3 - the change from a strict check (the ===) to looser checking (==) and the ability to modify the operation to your liking. He also links to more information about this and other methods in the Laravel code on GitHub.

tagged: laravel collection where laravel53 feature series part6

Link: https://mattstauffer.co/blog/advanced-operations-with-collectionwhere-in-laravel-5-3


Trending Topics: