This commit is contained in:
James Cole
2018-03-09 05:52:52 +01:00
parent dff2d716a1
commit ace2ed8bd0

View File

@@ -146,15 +146,12 @@ class Support
*/ */
protected function summarizeByAccount(Collection $collection): array protected function summarizeByAccount(Collection $collection): array
{ {
$result = [ $result = [];
'sum' => '0',
];
/** @var Transaction $transaction */ /** @var Transaction $transaction */
foreach ($collection as $transaction) { foreach ($collection as $transaction) {
$accountId = $transaction->account_id; $accountId = $transaction->account_id;
$result[$accountId] = $result[$accountId] ?? '0'; $result[$accountId] = $result[$accountId] ?? '0';
$result[$accountId] = bcadd($transaction->transaction_amount, $result[$accountId]); $result[$accountId] = bcadd($transaction->transaction_amount, $result[$accountId]);
$result['sum'] = bcadd($result['sum'], $transaction->transaction_amount);
} }
return $result; return $result;