File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
src/Illuminate/Database/Eloquent Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -665,17 +665,33 @@ public function getQueueableClass()
665
665
return ;
666
666
}
667
667
668
- $ class = get_class ($ this ->first ());
668
+ $ class = $ this -> getModelClass ($ this ->first ());
669
669
670
670
$ this ->each (function ($ model ) use ($ class ) {
671
- if (get_class ($ model ) !== $ class ) {
671
+ if ($ this -> getModelClass ($ 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 identifiers for all of the entities.
681
+ *
682
+ * @return array<int, mixed>
683
+ */
684
+ protected function getModelClass ($ model )
685
+ {
686
+ if (method_exists ($ model ,'getClassNameForSerialization ' )) {
687
+ return $ model ->getClassNameForSerialization ();
688
+ }
689
+
690
+ return get_class ($ model );
691
+ }
692
+
693
+
694
+
679
695
/**
680
696
* Get the identifiers for all of the entities.
681
697
*
You can’t perform that action at this time.
0 commit comments