Skip to content

Commit

Permalink
feat: added the ability to use resolveRelationUsing and still use the…
Browse files Browse the repository at this point in the history
… package

feat: added the ability to use resolveRelationUsing and still use the package
  • Loading branch information
lukas-frey authored Jun 27, 2024
2 parents 05e0004 + f81d5b3 commit 44e8a68
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Ancestor.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public function getRelationship(Model $record)
return $record->{Str::plural($this->getRelationshipName())}();
}

if ($record->relationResolver($record::class, $this->getRelationshipName()) ){
return $record->{$this->getRelationshipName()}();
}

return null;
}

Expand All @@ -51,6 +55,10 @@ public function getInverseRelationship(Model $record): ?Relation
return $record->{$this->getInverseRelationshipName()}();
}

if ($record->relationResolver($record::class, $this->getInverseRelationshipName()) != null){
return $record->{$this->getInverseRelationshipName()}();
}

return null;
}

Expand Down

0 comments on commit 44e8a68

Please sign in to comment.