Skip to content

Commit

Permalink
Use getAttribute get the key of parent
Browse files Browse the repository at this point in the history
  • Loading branch information
zingimmick committed Jan 24, 2022
1 parent fbb22af commit de7a89f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Relations/BelongsToOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function match(array $models, Collection $results, $relation): array
*/
public function getResults()
{
if ($this->parent->{$this->parentKey} === null) {
if ($this->parent->getAttribute($this->parentKey) === null) {
return $this->getDefaultFor($this->parent);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Relations/MorphToOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function match(array $models, Collection $results, $relation): array
*/
public function getResults()
{
if ($this->parent->{$this->parentKey} === null) {
if ($this->parent->getAttribute($this->parentKey) === null) {
return $this->getDefaultFor($this->parent);
}

Expand Down

0 comments on commit de7a89f

Please sign in to comment.