MarlonV
175
6
Laravel

Sum per user

Posted 3 weeks ago by MarlonV

This gives me a total of the authenticated user. But when i'am in the payments index, a want to sum up the totals per user. Anyone can help me out?

    public static function getTotalPayd()
    {
        return Payment::whereUserId(Auth::id())->sum('amount_payd');
    }

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