Fix bugs in Eloquent.

This commit is contained in:
Taylor Otwell
2013-01-05 16:45:34 -06:00
parent 28a880b5b5
commit b0eb9a8b42

View File

@@ -711,10 +711,10 @@ abstract class Model {
{ {
foreach (array('attributes', 'relationships') as $source) foreach (array('attributes', 'relationships') as $source)
{ {
if (array_key_exists($key, $this->$source)) return true; if (array_key_exists($key, $this->{$source})) return ! empty($this->{$source}[$key]);
} }
if (method_exists($this, $key)) return true; return false;
} }
/** /**
@@ -727,7 +727,7 @@ abstract class Model {
{ {
foreach (array('attributes', 'relationships') as $source) foreach (array('attributes', 'relationships') as $source)
{ {
unset($this->$source[$key]); unset($this->{$source}[$key]);
} }
} }