Skip to content

Instantly share code, notes, and snippets.

@julianobailao
Created August 31, 2016 19:10
Show Gist options
  • Select an option

  • Save julianobailao/fc8b517ae95ebaed8b35d5331c6db7c0 to your computer and use it in GitHub Desktop.

Select an option

Save julianobailao/fc8b517ae95ebaed8b35d5331c6db7c0 to your computer and use it in GitHub Desktop.
Collection only, except and filter methods
<?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