@@ -11,10 +11,6 @@ View Sample MongoDB Data
1111.. meta::
1212 :keywords: test connection, runnable, code example
1313
14- Follow the steps in this section to create the
15- To create a webpage that displays data from your database, you need
16- to create a model, view, and controller.
17-
1814.. procedure::
1915 :style: connected
2016
@@ -45,10 +41,10 @@ to create a model, view, and controller.
4541
4642 - Replace the ``Illuminate\Database\Eloquent\Model`` import with ``MongoDB\Laravel\Eloquent\Model``
4743 - Specify ``mongodb`` in the ``$connection`` field
48-
49-
44+
45+
5046 Your ``Movie.php`` file should contain the following code:
51-
47+
5248 .. code-block:: php
5349
5450 <?php
@@ -63,12 +59,12 @@ to create a model, view, and controller.
6359 }
6460
6561 .. step:: Add a Controller Function
66-
67- Navigate to the ``app/Http/Controllers`` directory and open the
62+
63+ Navigate to the ``app/Http/Controllers`` directory and open the
6864 ``MovieController.php`` file. Replace the ``show()`` function
6965 with the following code to retrieve results that match a
7066 database query and render it in the view:
71-
67+
7268 .. code-block:: php
7369
7470 public function show()
@@ -87,11 +83,11 @@ to create a model, view, and controller.
8783 Navigate to the ``routes`` directory and open the ``web.php`` file.
8884 Add an import for the ``MovieController`` and a route called
8985 ``browse_movies`` as shown in the following code:
90-
86+
9187 .. code-block:: php
9288
93- <?php
94-
89+ <?php
90+
9591 // ...
9692 use App\Http\Controllers\MovieController;
9793
@@ -145,9 +141,9 @@ to create a model, view, and controller.
145141
146142 Navigate to the application root directory and run the following command
147143 to start your PHP built-in web server:
148-
144+
149145 .. code-block:: bash
150-
146+
151147 php artisan serve
152148
153149 If the server starts successfully, you should see the following message:
0 commit comments