laravel/framework — pull request #4828 by JosephSilber (2014-06-25 02:54:49+00:00)
Title: Add keyBy method to Collection

Adds a new `keyBy` method to `Illuminate\Support\Collection`, so that you can do something like this:

$roles = Role::all()->keyBy('name');

which would result in an array similar to this:

[
'admin' => ...model...,
'editor' => ...model...,
'user' => ...model...,
]

For reference, [see this question on StackOverflow](http://stackoverflow.com/questions/24130507/eloquent-column-list-by-key-with-array-as-values).