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
3434 // end-eloquent-find-one
3535
3636 $ this ->assertInstanceOf (Movie::class, $ movie );
37- $ this ->assertSame ($ movie ->title , 'The Shawshank Redemption ' );
38-
37+
3938 // begin-qb-find-one
4039 $ movie = DB ::table ('movies ' )
4140 ->where ('directors ' , 'Rob Reiner ' )
4241 ->orderBy ('_id ' )
4342 ->first ();
4443
45- echo print_r ( $ movie) ;
44+ echo $ movie[ ' title ' ] ;
4645 // end-qb-find-one
46+
47+ $ this ->assertSame ($ movie ['title ' ], 'The Shawshank Redemption ' );
4748 }
4849}
Original file line number Diff line number Diff line change @@ -47,15 +47,15 @@ public function testUpdateOne(): void
4747
4848 // begin-qb-update-one
4949 $ 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+ );
5959
6060 echo 'Updated documents: ' . $ updates ;
6161 // end-qb-update-one
You can’t perform that action at this time.
0 commit comments