File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ public function getIdAttribute($value)
4848 // If there is an actual id attribute, then return that.
4949 if ($ value ) return $ value ;
5050
51- return $ this ->getKey () ;
51+ return $ this ->attributes [ $ this -> getKeyName ()] ;
5252 }
5353
5454 /**
Original file line number Diff line number Diff line change 66use DateTime ;
77use Closure ;
88
9+ use Illuminate \Database \Query \Expression ;
910use Jenssegers \Mongodb \Connection ;
1011
1112class Builder extends \Illuminate \Database \Query \Builder {
@@ -507,11 +508,19 @@ public function truncate()
507508 */
508509 public function raw ($ expression = null )
509510 {
511+ // Execute the closure on the mongodb collection
510512 if ($ expression instanceof Closure)
511513 {
512514 return call_user_func ($ expression , $ this ->collection );
513515 }
514516
517+ // Create an expression for the given value
518+ else if (!is_null ($ expression ))
519+ {
520+ return new Expression ($ expression );
521+ }
522+
523+ // Quick access to the mongodb collection
515524 return $ this ->collection ;
516525 }
517526
You can’t perform that action at this time.
0 commit comments