Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Implemented #264
James Colec619b8730b5d
diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.phpindex a858e82252..e6f517c9a8 100644--- a/app/Http/Controllers/BudgetController.php+++ b/app/Http/Controllers/BudgetController.php@@ -164,6 +164,8 @@ class BudgetController extends Controller*/public function index(BudgetRepositoryInterface $repository, AccountCrudInterface $crud){+ $repository->cleanupBudgets();+$budgets = $repository->getActiveBudgets();$inactive = $repository->getInactiveBudgets();$spent = '0';diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.phpindex 04d63893a5..b104c8f292 100644--- a/app/Repositories/Budget/BudgetRepository.php+++ b/app/Repositories/Budget/BudgetRepository.php@@ -156,6 +156,18 @@ class BudgetRepository implements BudgetRepositoryInterfacereturn $set;}+ /**+ * @return bool+ */+ public function cleanupBudgets(): bool+ {+ // delete limits with amount 0:+ BudgetLimit::where('amount', 0)->delete();++ return true;++ }+/*** @return Collection*/diff --git a/app/Repositories/Budget/BudgetRepositoryInterface.php b/app/Repositories/Budget/BudgetRepositoryInterface.phpindex 6feeb5336c..31bf8d4ed2 100644--- a/app/Repositories/Budget/BudgetRepositoryInterface.php+++ b/app/Repositories/Budget/BudgetRepositoryInterface.php@@ -111,6 +111,11 @@ interface BudgetRepositoryInterface*/public function spentInPeriod(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end) : string;+ /**+ * @return bool+ */+ public function cleanupBudgets(): bool;+/*** @param array $data*