Skip to content

Commit 4bbfbda

Browse files
committed
remove controller
1 parent 22f480c commit 4bbfbda

File tree

1 file changed

+28
-61
lines changed

1 file changed

+28
-61
lines changed

docs/fundamentals/read-operations/query-logging.txt

Lines changed: 28 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -42,68 +42,35 @@ memory. To retrieve the logs, use one of the following methods:
4242
The following example enables query logging, performs some queries, then
4343
prints the query log:
4444

45-
.. tabs::
46-
47-
.. tab:: Query Syntax
48-
:tabid: query-syntax
49-
50-
Use the following syntax to specify the query:
51-
52-
.. literalinclude:: /includes/fundamentals/read-operations/ReadOperationsTest.php
53-
:language: php
54-
:dedent:
55-
:start-after: start-query-log
56-
:end-before: end-query-log
57-
:emphasize-lines: 1, 7
58-
59-
.. tab:: Controller Method
60-
:tabid: controller
61-
62-
To see the logs in the ``browse_movies`` view, edit the ``show()`` function
63-
in the ``MovieController.php`` file to resemble the following code:
64-
65-
.. io-code-block::
66-
:copyable: true
67-
68-
.. input::
69-
:language: php
70-
71-
class MovieController
72-
{
73-
public function show()
74-
{
75-
DB::connection('mongodb')->enableQueryLog();
76-
77-
Movie::where('title', 'Carrie')->get();
78-
Movie::where('year', '<', 2005)->get();
79-
Movie::where('imdb.rating', '>', 8.5)->get();
80-
81-
$logs = DB::connection('mongodb')->getQueryLog();
82-
foreach ($logs as $log) {
83-
echo json_encode($log, JSON_PRETTY_PRINT);
84-
}
85-
}
86-
}
87-
88-
.. output::
89-
:language: none
90-
:visible: false
45+
.. io-code-block::
46+
:copyable: true
47+
48+
.. input:: /includes/fundamentals/read-operations/ReadOperationsTest.php
49+
:language: php
50+
:dedent:
51+
:start-after: start-query-log
52+
:end-before: end-query-log
53+
:emphasize-lines: 1, 7
54+
55+
.. output::
56+
:language: json
57+
:visible: false
9158

92-
{
93-
"query": "{ \"find\" : \"movies\", \"filter\" : { \"title\" : \"Carrie\" } }",
94-
"bindings": [],
95-
"time": 29476
96-
}
97-
{
98-
"query": "{ \"find\" : \"movies\", \"filter\" : { \"year\" : { \"$lt\" : { \"$numberInt\" : \"2005\" } } } }",
99-
"bindings": [],
100-
"time": 29861
101-
}
102-
{
103-
"query": "{ \"find\" : \"movies\", \"filter\" : { \"imdb.rating\" : { \"$gt\" : { \"$numberDouble\" : \"8.5\" } } } }",
104-
"bindings": [],
105-
"time": 27251
106-
}
59+
{
60+
"query": "{ \"find\" : \"movies\", \"filter\" : { \"title\" : \"Carrie\" } }",
61+
"bindings": [],
62+
"time": 29476
63+
}
64+
{
65+
"query": "{ \"find\" : \"movies\", \"filter\" : { \"year\" : { \"$lt\" : { \"$numberInt\" : \"2005\" } } } }",
66+
"bindings": [],
67+
"time": 29861
68+
}
69+
{
70+
"query": "{ \"find\" : \"movies\", \"filter\" : { \"imdb.rating\" : { \"$gt\" : { \"$numberDouble\" : \"8.5\" } } } }",
71+
"bindings": [],
72+
"time": 27251
73+
}
10774

10875
Additional Information
10976
----------------------

0 commit comments

Comments
 (0)