From f77b6475ff0ff065cb66bb45dcf7d57941e8c312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Fri, 10 Sep 2021 01:49:49 +0300 Subject: [PATCH] fixed document history --- app/Jobs/Document/CreateDocumentHistory.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/Jobs/Document/CreateDocumentHistory.php b/app/Jobs/Document/CreateDocumentHistory.php index 4b3773550..1deafdc0e 100644 --- a/app/Jobs/Document/CreateDocumentHistory.php +++ b/app/Jobs/Document/CreateDocumentHistory.php @@ -8,6 +8,7 @@ use App\Interfaces\Job\HasSource; use App\Interfaces\Job\ShouldCreate; use App\Models\Document\Document; use App\Models\Document\DocumentHistory; +use Illuminate\Http\Request; class CreateDocumentHistory extends Job implements HasOwner, HasSource, ShouldCreate { @@ -47,10 +48,20 @@ class CreateDocumentHistory extends Job implements HasOwner, HasSource, ShouldCr public function getCustomSourceName(): string { - if (empty($this->request) || empty($this->request['created_from'])) { + if (empty($this->request)) { return $this->getSourceName(); } + if (is_array($this->request)) { + if (empty($this->request['created_from'])) { + return $this->getSourceName(); + } + } elseif ($this->request instanceof Request) { + if ($this->request->missing('created_from')) { + return $this->getSourceName(); + } + } + return $this->request['created_from']; } }