Browse Source

Merge pull request #1974 from neoascetic/belongs_to_call_a_getter

Access foreign property in Belongs_To through a getter
Taylor Otwell 11 years ago
parent
commit
1fdd186dde
1 changed files with 2 additions and 2 deletions
  1. 2 2
      laravel/database/eloquent/relationships/belongs_to.php

+ 2 - 2
laravel/database/eloquent/relationships/belongs_to.php

@@ -110,7 +110,7 @@ class Belongs_To extends Relationship {
 	 */
 	public function foreign_value()
 	{
-		return $this->base->get_attribute($this->foreign);
+		return $this->base->{$this->foreign};
 	}
 	
 	/**
@@ -126,4 +126,4 @@ class Belongs_To extends Relationship {
 		return $this->base;
 	}
 
-}
+}