@@ -45,18 +45,18 @@ View Sample MongoDB Data
45
45
46
46
Your ``Movie.php`` file should contain the following code:
47
47
48
- .. code-block:: php
48
+ .. code-block:: php
49
49
50
- <?php
50
+ <?php
51
51
52
- namespace App\Models;
52
+ namespace App\Models;
53
53
54
- use MongoDB\Laravel\Eloquent\Model;
54
+ use MongoDB\Laravel\Eloquent\Model;
55
55
56
- class Movie extends Model
57
- {
58
- protected $connection = 'mongodb';
59
- }
56
+ class Movie extends Model
57
+ {
58
+ protected $connection = 'mongodb';
59
+ }
60
60
61
61
.. step:: Add a Controller Function
62
62
@@ -82,7 +82,7 @@ View Sample MongoDB Data
82
82
83
83
Open the ``web.php`` file in the ``routes`` directory.
84
84
Add an import for the ``MovieController`` and a route called
85
- ``browse_movies`` as shown in the following code:
85
+ ``browse_movies`` as shown in the following code:
86
86
87
87
.. code-block:: php
88
88
@@ -107,36 +107,36 @@ View Sample MongoDB Data
107
107
108
108
INFO View [resources/views/browse_movie.blade.php] created successfully.
109
109
110
- Open the ``browse_movie.blade.php`` view file in the ``resources/views``
111
- directory. Replace the contents with the following code:
112
-
113
- .. code-block:: bash
114
-
115
- <!DOCTYPE html>
116
- <html>
117
- <head>
118
- <title>Browse Movies</title>
119
- </head>
120
- <body>
121
- <h2>Movies</h2>
122
-
123
- @forelse ($movies as $movie)
124
- <p>
125
- Title: {{ $movie->title }}<br>
126
- Year: {{ $movie->year }}<br>
127
- Runtime: {{ $movie->runtime }}<br>
128
- IMDB Rating: {{ $movie->imdb['rating'] }}<br>
129
- IMDB Votes: {{ $movie->imdb['votes'] }}<br>
130
- Plot: {{ $movie->plot }}<br>
131
- </p>
132
- @empty
133
- <p>No results</p>
134
- @endforelse
135
-
136
- </body>
137
- </html>
138
-
139
- .. step:: Start your Laravel Application
110
+ Open the ``browse_movie.blade.php`` view file in the ``resources/views``
111
+ directory. Replace the contents with the following code:
112
+
113
+ .. code-block:: bash
114
+
115
+ <!DOCTYPE html>
116
+ <html>
117
+ <head>
118
+ <title>Browse Movies</title>
119
+ </head>
120
+ <body>
121
+ <h2>Movies</h2>
122
+
123
+ @forelse ($movies as $movie)
124
+ <p>
125
+ Title: {{ $movie->title }}<br>
126
+ Year: {{ $movie->year }}<br>
127
+ Runtime: {{ $movie->runtime }}<br>
128
+ IMDB Rating: {{ $movie->imdb['rating'] }}<br>
129
+ IMDB Votes: {{ $movie->imdb['votes'] }}<br>
130
+ Plot: {{ $movie->plot }}<br>
131
+ </p>
132
+ @empty
133
+ <p>No results</p>
134
+ @endforelse
135
+
136
+ </body>
137
+ </html>
138
+
139
+ .. step:: Start your Laravel Application
140
140
141
141
Run the following command from the application root directory
142
142
to start your PHP built-in web server:
@@ -154,17 +154,17 @@ View Sample MongoDB Data
154
154
155
155
Press Ctrl+C to stop the server
156
156
157
- .. step:: View the Movie Data
157
+ .. step:: View the Movie Data
158
158
159
- Open http://127.0.0.1:8000/browse_movies in your web browser. If it runs
160
- successfully, you should see a list of movies and details about each of them.
159
+ Open http://127.0.0.1:8000/browse_movies in your web browser. If it runs
160
+ successfully, you should see a list of movies and details about each of them.
161
161
162
- .. tip::
162
+ .. tip::
163
163
164
- You can run the ``php artisan route:list`` command from your application
165
- root directory to view a list of available routes.
164
+ You can run the ``php artisan route:list`` command from your application
165
+ root directory to view a list of available routes.
166
166
167
- .. include:: /includes/quick-start/troubleshoot.rst
167
+ .. include:: /includes/quick-start/troubleshoot.rst
168
168
169
- .. button:: Next: Write Data
170
- :uri: /quick-start/write-data/
169
+ .. button:: Next: Write Data
170
+ :uri: /quick-start/write-data/
0 commit comments