Sum relationship

I have a User model and a Course model. with a relationship between them, this relationship is defined as "enrollment" (enrollment is basically the pivot table of the relationship) I have made a filament resource for enrollments. I want to get the sum of the costs of all courses If I use the default Sum, I get the unique sum like so:
enrollments table:
id | user_id | course_id|
1 | 1 | 32 |
2 | 1 | 36 |
3 | 2 | 32 |
enrollments table:
id | user_id | course_id|
1 | 1 | 32 |
2 | 1 | 36 |
3 | 2 | 32 |
this currently returns the following cost of course 32 + cost of course 36. but what I want is to return cost of course 32 + cost of course 36 + cost of course 32
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server