mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-04 03:43:07 +00:00
Add currency symbol to API
This commit is contained in:
@@ -76,7 +76,7 @@ class AccountController extends Controller
|
|||||||
$date = $data['date'] ?? today(config('app.timezone'));
|
$date = $data['date'] ?? today(config('app.timezone'));
|
||||||
|
|
||||||
$return = [];
|
$return = [];
|
||||||
$result = $this->repository->searchAccount((string) $query, $types, $data['limit']);
|
$result = $this->repository->searchAccount((string)$query, $types, $data['limit']);
|
||||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
$defaultCurrency = app('amount')->getDefaultCurrency();
|
||||||
|
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
@@ -97,6 +97,7 @@ class AccountController extends Controller
|
|||||||
'currency_id' => $currency->id,
|
'currency_id' => $currency->id,
|
||||||
'currency_name' => $currency->name,
|
'currency_name' => $currency->name,
|
||||||
'currency_code' => $currency->code,
|
'currency_code' => $currency->code,
|
||||||
|
'currency_symbol' => $currency->symbol,
|
||||||
'currency_decimal_places' => $currency->decimal_places,
|
'currency_decimal_places' => $currency->decimal_places,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -105,11 +106,14 @@ class AccountController extends Controller
|
|||||||
$order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE];
|
$order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE];
|
||||||
|
|
||||||
|
|
||||||
usort($return, function ($a, $b) use ($order) {
|
usort(
|
||||||
|
$return, function ($a, $b) use ($order) {
|
||||||
$pos_a = array_search($a['type'], $order);
|
$pos_a = array_search($a['type'], $order);
|
||||||
$pos_b = array_search($b['type'], $order);
|
$pos_b = array_search($b['type'], $order);
|
||||||
|
|
||||||
return $pos_a - $pos_b;
|
return $pos_a - $pos_b;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
return response()->json($return);
|
return response()->json($return);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user