Skip to content

Commit 754b12b

Browse files
committed
Merge branch 'Smoggert/9.x' into 9.x
2 parents c4b61fa + 9837954 commit 754b12b

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/Illuminate/Database/Eloquent/Collection.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,17 +665,30 @@ public function getQueueableClass()
665665
return;
666666
}
667667

668-
$class = get_class($this->first());
668+
$class = $this->getQueueableModelClass($this->first());
669669

670670
$this->each(function ($model) use ($class) {
671-
if (get_class($model) !== $class) {
671+
if ($this->getQueueableModelClass($model) !== $class) {
672672
throw new LogicException('Queueing collections with multiple model types is not supported.');
673673
}
674674
});
675675

676676
return $class;
677677
}
678678

679+
/**
680+
* Get the queueable class name for the given model.
681+
*
682+
* @param \Illuminate\Database\Eloquent\Model $model
683+
* @return string
684+
*/
685+
protected function getQueueableModelClass($model)
686+
{
687+
return method_exists($model, 'getQueueableClassName')
688+
? $model->getQueueableClassName()
689+
: get_class($model);
690+
}
691+
679692
/**
680693
* Get the identifiers for all of the entities.
681694
*

0 commit comments

Comments
 (0)