Skip to content

Commit

Permalink
Merge pull request #102 from ziming/patch-3
Browse files Browse the repository at this point in the history
Better resolution of polymorphic relations for sub models in STI
  • Loading branch information
JustSteveKing authored May 16, 2022
2 parents 8d2afc7 + b971d59 commit 2779b83
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/HasParent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down

0 comments on commit 2779b83

Please sign in to comment.