Skip to content

Commit

Permalink
fixed document history
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Sep 9, 2021
1 parent 1f2b5e7 commit f77b647
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/Jobs/Document/CreateDocumentHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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
{
Expand Down Expand Up @@ -47,10 +48,20 @@ public function handle(): DocumentHistory

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'];
}
}

0 comments on commit f77b647

Please sign in to comment.