m4martie
219
12
Laravel

How to sum Values of duplicate ID's

Posted 3 months ago by m4martie

I have the same user_id's with different and I want to compute the total points of that particular user. And this is what I did but I'm getting errors and/or just "0"

Controller

$points = ActivityPoint::where('points', '$reports->points')->sum('points');

And how I call to .blade

{{ $points }}

Need help for this, thank you in advance.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.