Skip to content
Advertisement

How to get sum and separate the total per Id in laravel

This is my query in my controller

JavaScript

Result of my query… I want to get total of separate project_code

JavaScript

Also I tried this but it only get the sum of all

JavaScript

Result of my query..

JavaScript

Result I want to achieve..

JavaScript

Advertisement

Answer

You don’t need to change the query. Just change the foreach loop code.

JavaScript

// The Section which calls the function show().

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement