From 668b17c2e43da7c8aead5ea756a273c8c1241aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Thu, 7 Oct 2021 12:09:45 +0300 Subject: [PATCH] Added delete category set default. --- app/Jobs/Setting/DeleteCategory.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/Jobs/Setting/DeleteCategory.php b/app/Jobs/Setting/DeleteCategory.php index 5018718ab..454637da9 100644 --- a/app/Jobs/Setting/DeleteCategory.php +++ b/app/Jobs/Setting/DeleteCategory.php @@ -47,6 +47,16 @@ class DeleteCategory extends Job implements ShouldDelete 'transactions' => 'transactions', ]; - return $this->countRelationships($this->model, $rels); + $relationships = $this->countRelationships($this->model, $rels); + + if ($this->model->id == setting('default.income_category')) { + $relationships[] = strtolower(trans_choice('general.incomes', 1)); + } + + if ($this->model->id == setting('default.expense_category')) { + $relationships[] = strtolower(trans_choice('general.incomes', 1)); + } + + return $relationships; } }