@@ -7,9 +7,9 @@ Find a Document
7
7
You can retrieve a single document from a collection by chaining the ``where()`` and
8
8
``first()`` methods on an Eloquent model or a query builder.
9
9
10
- Pass a query filter to the ``where()`` method and call the ``first()`` method to return
11
- one document in the collection that matches the filter. If multiple documents match the
12
- query filter, ``first()`` returns the first matching document according to the documents'
10
+ Pass a query filter to the ``where()`` method and then call the ``first()`` method to
11
+ return one document in the collection that matches the filter. If multiple documents match
12
+ the query filter, ``first()`` returns the first matching document according to the documents'
13
13
:term:`natural order` in the database or according to the sort order that you can specify
14
14
by using the ``orderBy()`` method.
15
15
@@ -25,7 +25,7 @@ to represent the ``movies`` collection.
25
25
This example performs the following actions:
26
26
27
27
- Defines a query filter that matches documents in which the value of the ``directors`` field
28
- is ``" Rob Reiner" ``
28
+ includes ``' Rob Reiner' ``
29
29
- Retrieves the first document that matches the query filter, according to the sort order
30
30
specified by the ``orderBy()`` method
31
31
@@ -42,8 +42,15 @@ the HTML code that specifies a view, select the :guilabel:`View File Code` tab.
42
42
43
43
.. input::
44
44
:language: php
45
-
46
- class MovieController
45
+
46
+ <?php
47
+
48
+ namespace App\Http\Controllers;
49
+
50
+ use App\Models\Movie;
51
+ use Illuminate\Http\Request;
52
+
53
+ class MovieController extends Controller
47
54
{
48
55
public function show()
49
56
{
0 commit comments