You can group Eloquent results with Collections by any custom condition. Here's how to group by first letter of user's name:
$users = User::all()->groupBy(function($item) { return $item->name[0];});
You can group Eloquent results with Collections by any custom condition. Here's how to group by first letter of user's name:
$users = User::all()->groupBy(function($item) { return $item->name[0];});