Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Removed for-loop in favour of "pluck()" aka: RTFM.
James Colef99e46bf7533
diff --git a/app/Repositories/Category/SingleCategoryRepository.php b/app/Repositories/Category/SingleCategoryRepository.phpindex 5c115c9ce1..ada1aa5bf6 100644--- a/app/Repositories/Category/SingleCategoryRepository.php+++ b/app/Repositories/Category/SingleCategoryRepository.php@@ -110,10 +110,7 @@ class SingleCategoryRepository extends ComponentRepository implements SingleCate*/public function earnedInPeriodForAccounts(Category $category, Collection $accounts, Carbon $start, Carbon $end){- $accountIds = [];- foreach ($accounts as $account) {- $accountIds[] = $account->id;- }+ $accountIds = $accounts->pluck('id')->toArray();$sum= $category->transactionjournals()@@ -237,10 +234,7 @@ class SingleCategoryRepository extends ComponentRepository implements SingleCate*/public function spentInPeriodForAccounts(Category $category, Collection $accounts, Carbon $start, Carbon $end){- $accountIds = [];- foreach ($accounts as $account) {- $accountIds[] = $account->id;- }+ $accountIds = $accounts->pluck('id')->toArray();$sum= $categorydiff --git a/app/Repositories/Shared/ComponentRepository.php b/app/Repositories/Shared/ComponentRepository.phpindex f9584ef72d..6731c904cb 100644--- a/app/Repositories/Shared/ComponentRepository.php+++ b/app/Repositories/Shared/ComponentRepository.php@@ -39,11 +39,7 @@ class ComponentRepositoryreturn $cache->get(); // @codeCoverageIgnore}- $ids = [];- /** @var Account $account */- foreach ($accounts as $account) {- $ids[] = $account->id;- }+ $ids = $accounts->pluck('id')->toArray();$entry = $object->transactionjournals()