added db transaction to jobs
This commit is contained in:
@ -9,10 +9,10 @@ use App\Models\Banking\Transaction;
|
||||
|
||||
class CreateTransaction extends Job
|
||||
{
|
||||
protected $request;
|
||||
|
||||
protected $transaction;
|
||||
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
@ -32,17 +32,19 @@ class CreateTransaction extends Job
|
||||
{
|
||||
event(new TransactionCreating($this->request));
|
||||
|
||||
$this->transaction = Transaction::create($this->request->all());
|
||||
\DB::transaction(function () {
|
||||
$this->transaction = Transaction::create($this->request->all());
|
||||
|
||||
// Upload attachment
|
||||
if ($this->request->file('attachment')) {
|
||||
$media = $this->getMedia($this->request->file('attachment'), 'transactions');
|
||||
// Upload attachment
|
||||
if ($this->request->file('attachment')) {
|
||||
$media = $this->getMedia($this->request->file('attachment'), 'transactions');
|
||||
|
||||
$this->transaction->attachMedia($media, 'attachment');
|
||||
}
|
||||
$this->transaction->attachMedia($media, 'attachment');
|
||||
}
|
||||
|
||||
// Recurring
|
||||
$this->transaction->createRecurring();
|
||||
// Recurring
|
||||
$this->transaction->createRecurring();
|
||||
});
|
||||
|
||||
event(new TransactionCreated($this->transaction));
|
||||
|
||||
|
Reference in New Issue
Block a user