added amount for humans in account show page

This commit is contained in:
Denis Duliçi
2022-07-19 14:41:43 +03:00
parent 7944b22e72
commit 273f762fe7
3 changed files with 21 additions and 4 deletions

View File

@ -42,7 +42,20 @@ class Accounts extends Controller
->orWhereHas('income_transaction', fn ($query) => $query->where('account_id', $account->id))
->collect(['expense_transaction.paid_at' => 'desc']);
return view('banking.accounts.show', compact('account', 'transactions', 'transfers'));
$incoming_amount = money($account->income_balance, $account->currency_code, true);
$outgoing_amount = money($account->expense_balance, $account->currency_code, true);
$current_amount = money($account->balance, $account->currency_code, true);
$summary_amounts = [
'incoming_exact' => $incoming_amount->format(),
'incoming_for_humans' => $incoming_amount->formatForHumans(),
'outgoing_exact' => $outgoing_amount->format(),
'outgoing_for_humans' => $outgoing_amount->formatForHumans(),
'current_exact' => $current_amount->format(),
'current_for_humans' => $current_amount->formatForHumans(),
];
return view('banking.accounts.show', compact('account', 'transactions', 'transfers', 'summary_amounts'));
}
/**