Answers for "laravel sum of relationship group by"

PHP
2

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
Posted by: Guest on April-05-2021

Code answers related to "laravel sum of relationship group by"

Browse Popular Code Answers by Language