mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-20 00:20:03 +00:00
Code and tests for #1450
This commit is contained in:
@@ -230,6 +230,31 @@ class AutoCompleteController extends Controller
|
||||
return response()->json($return);
|
||||
}
|
||||
|
||||
/**
|
||||
* List of revenue accounts.
|
||||
*
|
||||
* @param AccountRepositoryInterface $repository
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function assetAccounts(AccountRepositoryInterface $repository): JsonResponse
|
||||
{
|
||||
$set = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||
$filtered = $set->filter(
|
||||
function (Account $account) {
|
||||
if (true === $account->active) {
|
||||
return $account;
|
||||
}
|
||||
|
||||
return false; // @codeCoverageIgnore
|
||||
}
|
||||
);
|
||||
$return = array_unique($filtered->pluck('name')->toArray());
|
||||
sort($return);
|
||||
|
||||
return response()->json($return);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a JSON list of all beneficiaries.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user