Skip to content

Commit e338fc2

Browse files
author
Chris Cho
authored
DOCSP-38076 quickstart updates for 11 (#2799)
* DOCSP-38076: quick start changes for Laravel 11
1 parent c6b683e commit e338fc2

File tree

4 files changed

+30
-14
lines changed

4 files changed

+30
-14
lines changed

docs/quick-start.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ that connects to a MongoDB deployment.
5353
.. tip::
5454

5555
You can download the complete web application project by cloning the
56-
`laravel-quickstart <https://github.com/mongodb-university/laravel-quickstart>`__
56+
`laravel-quickstart <https://github.com/mongodb-university/laravel-quickstart/>`__
5757
GitHub repository.
5858

5959
.. button:: Next: Download and Install

docs/quick-start/configure-mongodb.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,20 @@ Configure Your MongoDB Connection
4141

4242
// ...
4343

44-
.. step:: Add the Laravel MongoDB provider
44+
.. step:: Add the MongoDB provider
4545

46-
Open the ``app.php`` file in the ``config`` directory and
47-
add the following entry into the ``providers`` array:
46+
Open the ``providers.php`` file in the ``bootstrap`` directory and add
47+
the following entry into the array:
4848

4949
.. code-block::
5050

5151
MongoDB\Laravel\MongoDBServiceProvider::class,
5252

53+
.. tip::
54+
55+
To learn how to register the provider in Laravel 10.x, see
56+
`Registering Providers <https://laravel.com/docs/10.x/providers#registering-providers>`__.
57+
5358
After completing these steps, your Laravel web application is ready to
5459
connect to MongoDB.
5560

docs/quick-start/view-data.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ View MongoDB Data
6767

6868
public function show()
6969
{
70-
return view('browse_movies', [
71-
'movies' => Movie::where('runtime', '<', 60)
72-
->where('imdb.rating', '>', 8.5)
73-
->orderBy('imdb.rating', 'desc')
74-
->take(10)
75-
->get()
76-
]);
70+
return view('browse_movies', [
71+
'movies' => Movie::where('runtime', '<', 60)
72+
->where('imdb.rating', '>', 8.5)
73+
->orderBy('imdb.rating', 'desc')
74+
->take(10)
75+
->get()
76+
]);
7777
}
7878

7979
.. step:: Add a web route

docs/quick-start/write-data.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ Write Data to MongoDB
3232

3333
.. step:: Add an API route that calls the controller function
3434

35+
Generate an API route file by running the following command:
36+
37+
.. code-block:: bash
38+
39+
php artisan install:api
40+
41+
.. tip::
42+
43+
Skip this step if you are using Laravel 10.x because the file that
44+
the command generates already exists.
45+
3546
Import the controller and add an API route that calls the ``store()``
3647
method in the ``routes/api.php`` file:
3748

@@ -42,7 +53,7 @@ Write Data to MongoDB
4253
// ...
4354

4455
Route::resource('movies', MovieController::class)->only([
45-
'store'
56+
'store'
4657
]);
4758

4859

@@ -57,8 +68,8 @@ Write Data to MongoDB
5768

5869
class Movie extends Model
5970
{
60-
protected $connection = 'mongodb';
61-
protected $fillable = ['title', 'year', 'runtime', 'imdb', 'plot'];
71+
protected $connection = 'mongodb';
72+
protected $fillable = ['title', 'year', 'runtime', 'imdb', 'plot'];
6273
}
6374

6475
.. step:: Post a request to the API

0 commit comments

Comments
 (0)