From b971d59eab59dc44fb8eea78b7176ac9b83289d4 Mon Sep 17 00:00:00 2001 From: ziming Date: Sat, 12 Feb 2022 11:59:58 +0800 Subject: [PATCH] Better resolution of polymorphic relations for sub models in STI --- src/HasParent.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/HasParent.php b/src/HasParent.php index e4251c3..7205b5d 100644 --- a/src/HasParent.php +++ b/src/HasParent.php @@ -103,12 +103,9 @@ public function getClassNameForRelationships() */ public function getMorphClass() { - if ($this->parentHasHasChildrenTrait()) { - $parentClass = $this->getParentClass(); - return (new $parentClass)->getMorphClass(); - } + $parentClass = $this->getParentClass(); - return parent::getMorphClass(); + return (new $parentClass)->getMorphClass(); } /**