mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Removed for-loop in favour of "pluck()" aka: RTFM.
This commit is contained in:
parent
9f87890ead
commit
f99e46bf75
@ -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
|
||||
= $category
|
||||
|
@ -39,11 +39,7 @@ class ComponentRepository
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$ids = [];
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
$ids[] = $account->id;
|
||||
}
|
||||
$ids = $accounts->pluck('id')->toArray();
|
||||
|
||||
|
||||
$entry = $object->transactionjournals()
|
||||
|
Loading…
Reference in New Issue
Block a user