Need eloquent/fluent query to get sum with groupBy function.
So far I have tried:
$this->data[\'no_of_pages\'] = Document::sum(\'no_of_pages\'
Little bit refactored and convenient answer is (from @keroles Monsef)
Document::Where('some_condition',true) ->selectRaw("SUM(debit) as total_debit") ->selectRaw("SUM(credit) as total_credit") ->groupBy('id') ->get();