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