File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
src/Jenssegers/Mongodb/Eloquent Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -21,9 +21,10 @@ class Builder extends EloquentBuilder
21
21
* Update a record in the database.
22
22
*
23
23
* @param array $values
24
+ * @param array $options
24
25
* @return int
25
26
*/
26
- public function update (array $ values )
27
+ public function update (array $ values, array $ options = [] )
27
28
{
28
29
// Intercept operations on embedded models and delegate logic
29
30
// to the parent relation instance.
@@ -33,7 +34,7 @@ public function update(array $values)
33
34
return 1 ;
34
35
}
35
36
36
- return parent :: update ($ values );
37
+ return $ this -> query -> update ($ this -> addUpdatedAtColumn ( $ values), $ options );
37
38
}
38
39
39
40
/**
Original file line number Diff line number Diff line change @@ -429,6 +429,14 @@ public function testUpsert()
429
429
);
430
430
431
431
$ this ->assertEquals (1 , DB ::collection ('items ' )->count ());
432
+
433
+ Item::where ('name ' , 'spoon ' )
434
+ ->update (
435
+ ['amount ' => 1 ],
436
+ ['upsert ' => true ]
437
+ );
438
+
439
+ $ this ->assertEquals (2 , DB ::collection ('items ' )->count ());
432
440
}
433
441
434
442
public function testUnset ()
You can’t perform that action at this time.
0 commit comments