I already think in that but it will only return the grades for the history subject acumulated, so how I pass all the results to the view, I need to pass all the subjects, like this but I need to group the results by subject and then pass to the view
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
There might be a collection method you could use on your models to make it easier for you. You could try chaining them, such as where and sum.
$grades->where(‘subject’, ‘history’)->sum(‘score’)
Laravel collections
I already think in that but it will only return the grades for the history subject acumulated, so how I pass all the results to the view, I need to pass all the subjects, like this but I need to group the results by subject and then pass to the view