We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 89e059b commit b625036Copy full SHA for b625036
src/Jenssegers/Mongodb/Model.php
@@ -48,7 +48,8 @@ public function getIdAttribute($value)
48
// If there is an actual id attribute, then return that.
49
if ($value) return $value;
50
51
- return $this->attributes[$this->getKeyName()];
+ // Return primary key value if present
52
+ if (array_key_exists($this->getKeyName(), $this->attributes)) return $this->attributes[$this->getKeyName()];
53
}
54
55
/**
0 commit comments