sum and group by row in laravel code example
Example: laravel sum group by
$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