laravel/framework — pull request #714 by KaneCohen (2013-03-27 05:32:24+00:00)
Title: Add values method to the Collection.

Tiny helpful method to reset items index in Collection after said items were `filter`ed.

Explanation. Often, Collections might be used as an object which renders to json on echo/response. Right now it works great returning something like that:

````javascript
[{"id":"1","user_id":"1","name":"Foo"},{"id":"2","user_id":"2","name":"Bar"}]
````
Proper array.

But, if we use `filter` method on said collection:

````php
return $coll->filter(function($item) {
return $item->user_id == 2;
});
````
We'll get not an array of objects, but an object of objects:
````javascript
{"1":{"id":"2","user_id":"2","name":"Bar"}}
````

So, with this PR now user can reset item values:

````php
return $coll->filter(function($item) {
return $item->user_id == 2;
})->values();
````

Results in proper array:

````javascript
[{"id":"2","user_id":"2","name":"Bar"}]
````