Fixed document transaction updating upload file..
This commit is contained in:
parent
6c67e99a1b
commit
d4f2b5b4da
|
|
@ -39,19 +39,6 @@ class UpdateBankingDocumentTransaction extends Job implements ShouldUpdate
|
||||||
\DB::transaction(function () {
|
\DB::transaction(function () {
|
||||||
$this->transaction = $this->dispatch(new UpdateTransaction($this->transaction, $this->request));
|
$this->transaction = $this->dispatch(new UpdateTransaction($this->transaction, $this->request));
|
||||||
|
|
||||||
// Upload attachment
|
|
||||||
if ($this->request->file('attachment')) {
|
|
||||||
$this->deleteMediaModel($this->transaction, 'attachment', $this->request);
|
|
||||||
|
|
||||||
$media = $this->getMedia($this->request->file('attachment'), 'transactions');
|
|
||||||
|
|
||||||
$this->transaction->attachMedia($media, 'attachment');
|
|
||||||
} elseif ($this->request->isNotApi() && ! $this->request->file('attachment') && $this->transaction->attachment) {
|
|
||||||
$this->deleteMediaModel($this->transaction, 'attachment', $this->request);
|
|
||||||
} elseif ($this->request->isApi() && $this->request->has('remove_attachment') && $this->transaction->attachment) {
|
|
||||||
$this->deleteMediaModel($this->transaction, 'attachment', $this->request);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->model->save();
|
$this->model->save();
|
||||||
|
|
||||||
$this->createHistory();
|
$this->createHistory();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue