$docs = Document::groupBy('users_editor_id')
->selectRaw('sum(no_of_pages) as sum, users_editor_id')
->get(); //this return collection
//In Blade
@foreach($docs as $doc)
{{$doc->users_editor_id}} >-------< {{$doc->sum}}
@endforeach
$sums = $detailed->mapWithKeys(function ($group, $key) {
return [$key => $group->sum('sales_price')];
});
$sums = $detailed->mapWithKeys (function ($group, $key) { return [$key => $group->sum ('sales_price')]; });