This commit is contained in:
James Cole 2020-02-08 12:59:43 +01:00
parent cebc0d7568
commit 4cd642b8da
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
2 changed files with 6 additions and 5 deletions

View File

@ -240,7 +240,7 @@ class PiggyBankController extends Controller
foreach ($collection as $piggy) {
$array = $transformer->transform($piggy);
$account = $accountTransformer->transform($piggy->account);
$accountId = $account['id'];
$accountId = (int)$account['id'];
if (!isset($accounts[$accountId])) {
// create new:
$accounts[$accountId] = $account;

View File

@ -180,10 +180,11 @@ class AccountTransformer extends AbstractTransformer
private function getCurrency(Account $account): array
{
$currency = $this->repository->getAccountCurrency($account);
$currencyId = null;
$currencyCode = null;
$decimalPlaces = 2;
$currencySymbol = null;
$default = app('amount')->getDefaultCurrencyByUser($account->user);
$currencyId = $default->id;
$currencyCode = $default->code;
$decimalPlaces = $default->decimal_places;
$currencySymbol = $default->symbol;
if (null !== $currency) {
$currencyId = $currency->id;
$currencyCode = $currency->code;