mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-23 19:51:24 +00:00
Removed for-loop in favour of "pluck()" aka: RTFM.
This commit is contained in:
@@ -110,10 +110,7 @@ class SingleCategoryRepository extends ComponentRepository implements SingleCate
|
|||||||
*/
|
*/
|
||||||
public function earnedInPeriodForAccounts(Category $category, Collection $accounts, Carbon $start, Carbon $end)
|
public function earnedInPeriodForAccounts(Category $category, Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
$accountIds = [];
|
$accountIds = $accounts->pluck('id')->toArray();
|
||||||
foreach ($accounts as $account) {
|
|
||||||
$accountIds[] = $account->id;
|
|
||||||
}
|
|
||||||
$sum
|
$sum
|
||||||
= $category
|
= $category
|
||||||
->transactionjournals()
|
->transactionjournals()
|
||||||
@@ -237,10 +234,7 @@ class SingleCategoryRepository extends ComponentRepository implements SingleCate
|
|||||||
*/
|
*/
|
||||||
public function spentInPeriodForAccounts(Category $category, Collection $accounts, Carbon $start, Carbon $end)
|
public function spentInPeriodForAccounts(Category $category, Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
$accountIds = [];
|
$accountIds = $accounts->pluck('id')->toArray();
|
||||||
foreach ($accounts as $account) {
|
|
||||||
$accountIds[] = $account->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sum
|
$sum
|
||||||
= $category
|
= $category
|
||||||
|
|||||||
@@ -39,11 +39,7 @@ class ComponentRepository
|
|||||||
return $cache->get(); // @codeCoverageIgnore
|
return $cache->get(); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
$ids = [];
|
$ids = $accounts->pluck('id')->toArray();
|
||||||
/** @var Account $account */
|
|
||||||
foreach ($accounts as $account) {
|
|
||||||
$ids[] = $account->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$entry = $object->transactionjournals()
|
$entry = $object->transactionjournals()
|
||||||
|
|||||||
Reference in New Issue
Block a user