File tree Expand file tree Collapse file tree 2 files changed +13
-12
lines changed
docs/includes/usage-examples Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -34,15 +34,16 @@ public function testFindOne(): void
34
34
// end-eloquent-find-one
35
35
36
36
$ this ->assertInstanceOf (Movie::class, $ movie );
37
- $ this ->assertSame ($ movie ->title , 'The Shawshank Redemption ' );
38
-
37
+
39
38
// begin-qb-find-one
40
39
$ movie = DB ::table ('movies ' )
41
40
->where ('directors ' , 'Rob Reiner ' )
42
41
->orderBy ('_id ' )
43
42
->first ();
44
43
45
- echo print_r ( $ movie) ;
44
+ echo $ movie[ ' title ' ] ;
46
45
// end-qb-find-one
46
+
47
+ $ this ->assertSame ($ movie ['title ' ], 'The Shawshank Redemption ' );
47
48
}
48
49
}
Original file line number Diff line number Diff line change @@ -47,15 +47,15 @@ public function testUpdateOne(): void
47
47
48
48
// begin-qb-update-one
49
49
$ updates = DB ::table ('movies ' )
50
- ->where ( ' title ' , ' Carol ' )
51
- -> orderBy ( ' _id ' )
52
- -> first ()
53
- -> update ( [
54
- ' imdb ' => [
55
- ' rating ' => 7.3 ,
56
- ' votes ' => 142000 ,
57
- ],
58
- ] );
50
+ ->updateOne (
51
+ [ ' title ' => ' Carol ' ],
52
+ [ ' $set ' => [
53
+ ' imdb ' => [
54
+ ' rating ' => 7.3 ,
55
+ ' votes ' => 142000 ,
56
+ ] ,
57
+ ]]
58
+ );
59
59
60
60
echo 'Updated documents: ' . $ updates ;
61
61
// end-qb-update-one
You can’t perform that action at this time.
0 commit comments