There are tons of collection methods that aren't in the documentation but you can find them in the api http://laravel.com/api/4.2/ Maybe groupBy? And of course you can always do it the old fashion way by treating the collection like an array of objects.
groupBy would be before retrieval is complete. i was just thinking whether there is a more elegant way of filtering the collection.
so yeah i ended up using the old fashion way of treating the collection like an array of objects.
$allRoles = array();
foreach ($jobRoles as $jobRole)
{
$allRoles[$jobRole->slug] = $jobRole;
}
there are numerous collection methods for this
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community