Created
August 31, 2016 19:10
-
-
Save julianobailao/fc8b517ae95ebaed8b35d5331c6db7c0 to your computer and use it in GitHub Desktop.
Collection only, except and filter methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Only | |
| $customer->address()->only('main_address', 'secondary_address'); | |
| // Except | |
| $customer->address()->except('business_address', 'secondary_address'); | |
| // Filter | |
| $collection->filter(function (item) { | |
| return item === 'main_address'; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment