Added Transaction job new events..
This commit is contained in:
@ -3,6 +3,8 @@
|
||||
namespace App\Jobs\Banking;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Events\Banking\DocumentTransactionCreated;
|
||||
use App\Events\Banking\DocumentTransactionCreating;
|
||||
use App\Jobs\Banking\CreateTransaction;
|
||||
use App\Jobs\Document\CreateDocumentHistory;
|
||||
use App\Events\Document\PaidAmountCalculated;
|
||||
@ -27,6 +29,8 @@ class CreateBankingDocumentTransaction extends Job implements ShouldCreate
|
||||
|
||||
public function handle(): Transaction
|
||||
{
|
||||
event(new DocumentTransactionCreating($this->model, $this->request));
|
||||
|
||||
$this->prepareRequest();
|
||||
|
||||
$this->checkAmount();
|
||||
@ -46,6 +50,8 @@ class CreateBankingDocumentTransaction extends Job implements ShouldCreate
|
||||
$this->createHistory();
|
||||
});
|
||||
|
||||
event(new DocumentTransactionCreated($this->model, $this->transaction));
|
||||
|
||||
return $this->transaction;
|
||||
}
|
||||
|
||||
|
@ -3,9 +3,11 @@
|
||||
namespace App\Jobs\Banking;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Events\Banking\DocumentTransactionUpdated;
|
||||
use App\Events\Banking\DocumentTransactionUpdating;
|
||||
use App\Events\Document\PaidAmountCalculated;
|
||||
use App\Jobs\Banking\UpdateTransaction;
|
||||
use App\Jobs\Document\CreateDocumentHistory;
|
||||
use App\Events\Document\PaidAmountCalculated;
|
||||
use App\Interfaces\Job\ShouldUpdate;
|
||||
use App\Models\Banking\Transaction;
|
||||
use App\Models\Document\Document;
|
||||
@ -26,6 +28,8 @@ class UpdateBankingDocumentTransaction extends Job implements ShouldUpdate
|
||||
|
||||
public function handle(): Transaction
|
||||
{
|
||||
event(new DocumentTransactionUpdating($this->model, $this->transaction, $this->request));
|
||||
|
||||
$this->prepareRequest();
|
||||
|
||||
$this->checkAmount();
|
||||
@ -45,6 +49,8 @@ class UpdateBankingDocumentTransaction extends Job implements ShouldUpdate
|
||||
$this->createHistory();
|
||||
});
|
||||
|
||||
event(new DocumentTransactionUpdated($this->model, $this->transaction, $this->request));
|
||||
|
||||
return $this->transaction;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
namespace App\Jobs\Banking;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Events\Banking\TransactionUpdated;
|
||||
use App\Events\Banking\TransactionUpdating;
|
||||
use App\Interfaces\Job\ShouldUpdate;
|
||||
use App\Models\Banking\Transaction;
|
||||
|
||||
@ -12,6 +14,8 @@ class UpdateTransaction extends Job implements ShouldUpdate
|
||||
{
|
||||
$this->authorize();
|
||||
|
||||
event(new TransactionUpdating($this->model, $this->request));
|
||||
|
||||
\DB::transaction(function () {
|
||||
$this->model->update($this->request->all());
|
||||
|
||||
@ -32,6 +36,8 @@ class UpdateTransaction extends Job implements ShouldUpdate
|
||||
$this->model->updateRecurring($this->request->all());
|
||||
});
|
||||
|
||||
event(new TransactionUpdated($this->model, $this->request));
|
||||
|
||||
return $this->model;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user