Skip to content

Commit 1cab217

Browse files
committed
Use Job's displayName() for type if exist
1 parent 8d0dc85 commit 1cab217

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Trackable.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,18 @@ protected function prepareStatus(array $data = [])
5757
/** @var JobStatus $entityClass */
5858
$entityClass = app()->getAlias(JobStatus::class);
5959

60-
$data = array_merge(["type" => static::class], $data);
60+
$data = array_merge(["type" => $this->getDisplayName()], $data);
6161
/** @var JobStatus $status */
6262
$status = $entityClass::create($data);
6363

6464
$this->statusId = $status->id;
6565
}
6666

67+
protected function getDisplayName()
68+
{
69+
return method_exists($this, 'displayName') ? $this->displayName() : static::class;
70+
}
71+
6772
public function getJobStatusId()
6873
{
6974
if ($this->statusId == null) {

0 commit comments

Comments
 (0)