Skip to content

Instantly share code, notes, and snippets.

@notomato
Created August 17, 2012 09:58
Show Gist options
  • Save notomato/3377609 to your computer and use it in GitHub Desktop.
Save notomato/3377609 to your computer and use it in GitHub Desktop.
Working with collections
<?php
$posts = Posts::findAllBySomeCondition();
$posts->first(function($post) {
return $post->published == true;
});
$posts->each(function($post) {
return $post->counter++;
});
$ids = $posts->map(function($post) {
return $post->id;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment