From 8d806e6a1dbb7043b2a023b238079a1ed3f60972 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 11 Feb 2020 05:34:36 +0100 Subject: [PATCH] Fix issues related to #3111 --- app/Exceptions/GracefulNotFoundHandler.php | 1 + app/Services/Internal/Destroy/BudgetDestroyService.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/Exceptions/GracefulNotFoundHandler.php b/app/Exceptions/GracefulNotFoundHandler.php index 0b4b4c4ec0..5b7de43a1c 100644 --- a/app/Exceptions/GracefulNotFoundHandler.php +++ b/app/Exceptions/GracefulNotFoundHandler.php @@ -85,6 +85,7 @@ class GracefulNotFoundHandler extends ExceptionHandler return redirect(route('currencies.index')); break; case 'budgets.show': + case 'budgets.edit': $request->session()->reflash(); return redirect(route('budgets.index')); diff --git a/app/Services/Internal/Destroy/BudgetDestroyService.php b/app/Services/Internal/Destroy/BudgetDestroyService.php index c3b574c3fb..2cc6377ab4 100644 --- a/app/Services/Internal/Destroy/BudgetDestroyService.php +++ b/app/Services/Internal/Destroy/BudgetDestroyService.php @@ -60,5 +60,8 @@ class BudgetDestroyService // also delete all relations between categories and transactions: DB::table('budget_transaction')->where('budget_id', (int)$budget->id)->delete(); + + // also delete all budget limits + $budget->budgetlimits()->delete(); } }