mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Improved chart for #2938
This commit is contained in:
@@ -653,4 +653,20 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
{
|
||||
return $account->attachments()->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getUsedCurrencies(Account $account): Collection
|
||||
{
|
||||
$info = $account->transactions()->get(['transaction_currency_id', 'foreign_currency_id'])->toArray();
|
||||
$currencyIds = [];
|
||||
foreach ($info as $entry) {
|
||||
$currencyIds[] = (int) $entry['transaction_currency_id'];
|
||||
$currencyIds[] = (int) $entry['foreign_currency_id'];
|
||||
}
|
||||
$currencyIds = array_unique($currencyIds);
|
||||
|
||||
return TransactionCurrency::whereIn('id', $currencyIds)->get();
|
||||
}
|
||||
}
|
||||
|
@@ -47,6 +47,13 @@ interface AccountRepositoryInterface
|
||||
*/
|
||||
public function count(array $types): int;
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getUsedCurrencies(Account $account): Collection;
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
*
|
||||
|
Reference in New Issue
Block a user