I'm really new to eloquent, and I'm trying groupby the employee_id and do a sum function on the deductions field.. but I'm really having a hard time trying to sum the deductions.
here's my code:
$payroll = Timelog::groupBy('employee_id')->with('employee')->get(['employee_id','deductions']);
what I did is to add sum function after the groupby but I'm having an error..
any help will be appreciated.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire