diff --git a/app/Events/Banking/TransactionDeleted.php b/app/Events/Banking/TransactionDeleted.php new file mode 100644 index 000000000..e11ea9976 --- /dev/null +++ b/app/Events/Banking/TransactionDeleted.php @@ -0,0 +1,20 @@ +transaction = $transaction; + } +} diff --git a/app/Events/Banking/TransactionDeleting.php b/app/Events/Banking/TransactionDeleting.php new file mode 100644 index 000000000..f5a0d7b0d --- /dev/null +++ b/app/Events/Banking/TransactionDeleting.php @@ -0,0 +1,20 @@ +transaction = $transaction; + } +} diff --git a/app/Jobs/Banking/DeleteTransaction.php b/app/Jobs/Banking/DeleteTransaction.php index 7561d0a3d..8edac1325 100644 --- a/app/Jobs/Banking/DeleteTransaction.php +++ b/app/Jobs/Banking/DeleteTransaction.php @@ -3,6 +3,8 @@ namespace App\Jobs\Banking; use App\Abstracts\Job; +use App\Events\Banking\TransactionDeleting; +use App\Events\Banking\TransactionDeleted; use App\Interfaces\Job\ShouldDelete; class DeleteTransaction extends Job implements ShouldDelete @@ -11,11 +13,15 @@ class DeleteTransaction extends Job implements ShouldDelete { $this->authorize(); + event(new TransactionDeleting($this->model)); + \DB::transaction(function () { $this->model->recurring()->delete(); $this->model->delete(); }); + event(new TransactionDeleted($this->model)); + return true; }