Commit b6250367 authored by Jens Segers's avatar Jens Segers

Tweaking id accessor for #108

parent 89e059b5
...@@ -48,7 +48,8 @@ abstract class Model extends \Jenssegers\Eloquent\Model { ...@@ -48,7 +48,8 @@ abstract class Model extends \Jenssegers\Eloquent\Model {
// If there is an actual id attribute, then return that. // If there is an actual id attribute, then return that.
if ($value) return $value; if ($value) return $value;
return $this->attributes[$this->getKeyName()]; // Return primary key value if present
if (array_key_exists($this->getKeyName(), $this->attributes)) return $this->attributes[$this->getKeyName()];
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment