File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
src/Illuminate/Database/Eloquent Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -665,17 +665,30 @@ public function getQueueableClass()
665
665
return ;
666
666
}
667
667
668
- $ class = get_class ($ this ->first ());
668
+ $ class = $ this -> getQueueableModelClass ($ this ->first ());
669
669
670
670
$ this ->each (function ($ model ) use ($ class ) {
671
- if (get_class ($ model ) !== $ class ) {
671
+ if ($ this -> getQueueableModelClass ($ model ) !== $ class ) {
672
672
throw new LogicException ('Queueing collections with multiple model types is not supported. ' );
673
673
}
674
674
});
675
675
676
676
return $ class ;
677
677
}
678
678
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
+
679
692
/**
680
693
* Get the identifiers for all of the entities.
681
694
*
You can’t perform that action at this time.
0 commit comments