Skip to content

Commit

Permalink
Use Job's displayName() for type if exist
Browse files Browse the repository at this point in the history
  • Loading branch information
imTigger committed Sep 6, 2018
1 parent 8d0dc85 commit 1cab217
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Trackable.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,18 @@ protected function prepareStatus(array $data = [])
/** @var JobStatus $entityClass */
$entityClass = app()->getAlias(JobStatus::class);

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

$this->statusId = $status->id;
}

protected function getDisplayName()
{
return method_exists($this, 'displayName') ? $this->displayName() : static::class;
}

public function getJobStatusId()
{
if ($this->statusId == null) {
Expand Down

0 comments on commit 1cab217

Please sign in to comment.