mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-23 20:38:46 +00:00
Removed for-loop in favour of "pluck()" aka: RTFM.
This commit is contained in:
@@ -284,11 +284,7 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
|
|||||||
*/
|
*/
|
||||||
public function getBudgetsAndExpensesPerMonth(Collection $accounts, Carbon $start, Carbon $end)
|
public function getBudgetsAndExpensesPerMonth(Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
$ids = [];
|
$ids = $accounts->pluck('id')->toArray();
|
||||||
/** @var Account $account */
|
|
||||||
foreach ($accounts as $account) {
|
|
||||||
$ids[] = $account->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @var Collection $set */
|
/** @var Collection $set */
|
||||||
$set = Auth::user()->budgets()
|
$set = Auth::user()->budgets()
|
||||||
@@ -587,12 +583,7 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
|
|||||||
*/
|
*/
|
||||||
public function getBudgetedPerYear(Collection $budgets, Carbon $start, Carbon $end)
|
public function getBudgetedPerYear(Collection $budgets, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
$budgetIds = [];
|
$budgetIds = $budgets->pluck('id')->toArray();
|
||||||
|
|
||||||
/** @var Budget $budget */
|
|
||||||
foreach ($budgets as $budget) {
|
|
||||||
$budgetIds[] = $budget->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
$set = Auth::user()->budgets()
|
$set = Auth::user()->budgets()
|
||||||
->leftJoin('budget_limits', 'budgets.id', '=', 'budget_limits.budget_id')
|
->leftJoin('budget_limits', 'budgets.id', '=', 'budget_limits.budget_id')
|
||||||
@@ -626,16 +617,8 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
|
|||||||
*/
|
*/
|
||||||
public function getBudgetsAndExpensesPerYear(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end)
|
public function getBudgetsAndExpensesPerYear(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
$ids = [];
|
$ids = $accounts->pluck('id')->toArray();
|
||||||
/** @var Account $account */
|
$budgetIds = $budgets->pluck('id')->toArray();
|
||||||
foreach ($accounts as $account) {
|
|
||||||
$ids[] = $account->id;
|
|
||||||
}
|
|
||||||
$budgetIds = [];
|
|
||||||
/** @var Budget $budget */
|
|
||||||
foreach ($budgets as $budget) {
|
|
||||||
$budgetIds[] = $budget->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @var Collection $set */
|
/** @var Collection $set */
|
||||||
$set = Auth::user()->budgets()
|
$set = Auth::user()->budgets()
|
||||||
|
Reference in New Issue
Block a user