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];});
Only until Jan 16th: coupon RESOLUTION25 for 40% off Yearly/Lifetime membership!
Read more hereYou 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];});