File tree 2 files changed +10
-1
lines changed
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)
48
48
// If there is an actual id attribute, then return that.
49
49
if ($ value ) return $ value ;
50
50
51
- return $ this ->getKey () ;
51
+ return $ this ->attributes [ $ this -> getKeyName ()] ;
52
52
}
53
53
54
54
/**
Original file line number Diff line number Diff line change 6
6
use DateTime ;
7
7
use Closure ;
8
8
9
+ use Illuminate \Database \Query \Expression ;
9
10
use Jenssegers \Mongodb \Connection ;
10
11
11
12
class Builder extends \Illuminate \Database \Query \Builder {
@@ -507,11 +508,19 @@ public function truncate()
507
508
*/
508
509
public function raw ($ expression = null )
509
510
{
511
+ // Execute the closure on the mongodb collection
510
512
if ($ expression instanceof Closure)
511
513
{
512
514
return call_user_func ($ expression , $ this ->collection );
513
515
}
514
516
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
515
524
return $ this ->collection ;
516
525
}
517
526
You can’t perform that action at this time.
0 commit comments