Skip to content

Commit 1fdd186

Browse files
committed
Merge pull request #1974 from neoascetic/belongs_to_call_a_getter
Access foreign property in Belongs_To through a getter
2 parents 3965429 + 641ac8d commit 1fdd186

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

laravel/database/eloquent/relationships/belongs_to.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function match($relationship, &$children, $parents)
110110
*/
111111
public function foreign_value()
112112
{
113-
return $this->base->get_attribute($this->foreign);
113+
return $this->base->{$this->foreign};
114114
}
115115

116116
/**
@@ -126,4 +126,4 @@ public function bind($id)
126126
return $this->base;
127127
}
128128

129-
}
129+
}

0 commit comments

Comments
 (0)