From 8f1c369f171800f67ebd7f94f4ebbcc9a7d8367e Mon Sep 17 00:00:00 2001 From: Chris Cho Date: Tue, 26 Mar 2024 17:46:57 -0400 Subject: [PATCH 1/5] DOCSP-38076: quick start changes for Laravel 11 (cherry picked from commit cfb2c4c0ab6d2de8b57ec428070549a3ab3d4746) --- docs/quick-start/configure-mongodb.txt | 9 ++++++--- docs/quick-start/view-data.txt | 14 +++++++------- docs/quick-start/write-data.txt | 16 +++++++++++++--- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/docs/quick-start/configure-mongodb.txt b/docs/quick-start/configure-mongodb.txt index 66cd2380c..4c30c4b78 100644 --- a/docs/quick-start/configure-mongodb.txt +++ b/docs/quick-start/configure-mongodb.txt @@ -41,15 +41,18 @@ Configure Your MongoDB Connection // ... - .. step:: Add the Laravel MongoDB provider + .. step:: Add the MongoDB provider - Open the ``app.php`` file in the ``config`` directory and - add the following entry into the ``providers`` array: + Open the ``providers.php`` file in the ``bootstrap`` directory and add + the following entry into the array: .. code-block:: MongoDB\Laravel\MongoDBServiceProvider::class, + To learn how to register the provider in Laravel 10.x, see + `Registering Providers `__. + After completing these steps, your Laravel web application is ready to connect to MongoDB. diff --git a/docs/quick-start/view-data.txt b/docs/quick-start/view-data.txt index 35d53368c..52c0e5dc4 100644 --- a/docs/quick-start/view-data.txt +++ b/docs/quick-start/view-data.txt @@ -67,13 +67,13 @@ View MongoDB Data public function show() { - return view('browse_movies', [ - 'movies' => Movie::where('runtime', '<', 60) - ->where('imdb.rating', '>', 8.5) - ->orderBy('imdb.rating', 'desc') - ->take(10) - ->get() - ]); + return view('browse_movies', [ + 'movies' => Movie::where('runtime', '<', 60) + ->where('imdb.rating', '>', 8.5) + ->orderBy('imdb.rating', 'desc') + ->take(10) + ->get() + ]); } .. step:: Add a web route diff --git a/docs/quick-start/write-data.txt b/docs/quick-start/write-data.txt index 31568286a..64a33a72e 100644 --- a/docs/quick-start/write-data.txt +++ b/docs/quick-start/write-data.txt @@ -32,6 +32,16 @@ Write Data to MongoDB .. step:: Add an API route that calls the controller function + Generate an API route file by running the following command: + + .. code-block:: bash + + php artisan install:api + + .. tip:: + + For Laravel 10.x and earlier, you do not need to run this command. + Import the controller and add an API route that calls the ``store()`` method in the ``routes/api.php`` file: @@ -42,7 +52,7 @@ Write Data to MongoDB // ... Route::resource('movies', MovieController::class)->only([ - 'store' + 'store' ]); @@ -57,8 +67,8 @@ Write Data to MongoDB class Movie extends Model { - protected $connection = 'mongodb'; - protected $fillable = ['title', 'year', 'runtime', 'imdb', 'plot']; + protected $connection = 'mongodb'; + protected $fillable = ['title', 'year', 'runtime', 'imdb', 'plot']; } .. step:: Post a request to the API From d64d933dd5c78f096a10e2ff44f3f8017b1c0c2d Mon Sep 17 00:00:00 2001 From: Chris Cho Date: Tue, 26 Mar 2024 17:57:00 -0400 Subject: [PATCH 2/5] updates (cherry picked from commit 16ceef814231f9a0d1b02e2612d73809aa827c18) --- docs/quick-start.txt | 2 +- docs/quick-start/configure-mongodb.txt | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/quick-start.txt b/docs/quick-start.txt index d672f3e31..c9bb6a203 100644 --- a/docs/quick-start.txt +++ b/docs/quick-start.txt @@ -53,7 +53,7 @@ that connects to a MongoDB deployment. .. tip:: You can download the complete web application project by cloning the - `laravel-quickstart `__ + `laravel-quickstart `__ GitHub repository. .. button:: Next: Download and Install diff --git a/docs/quick-start/configure-mongodb.txt b/docs/quick-start/configure-mongodb.txt index 4c30c4b78..2f6dd0e36 100644 --- a/docs/quick-start/configure-mongodb.txt +++ b/docs/quick-start/configure-mongodb.txt @@ -50,8 +50,10 @@ Configure Your MongoDB Connection MongoDB\Laravel\MongoDBServiceProvider::class, - To learn how to register the provider in Laravel 10.x, see - `Registering Providers `__. + .. tip:: + + To learn how to register the provider in Laravel 10.x, see + `Registering Providers `__. After completing these steps, your Laravel web application is ready to connect to MongoDB. From f4bd3891844476f75ca5bf6a13b1845c5592df85 Mon Sep 17 00:00:00 2001 From: Chris Cho Date: Wed, 27 Mar 2024 10:41:25 -0400 Subject: [PATCH 3/5] update messaging --- docs/quick-start/write-data.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/quick-start/write-data.txt b/docs/quick-start/write-data.txt index 64a33a72e..a2a99422f 100644 --- a/docs/quick-start/write-data.txt +++ b/docs/quick-start/write-data.txt @@ -40,7 +40,8 @@ Write Data to MongoDB .. tip:: - For Laravel 10.x and earlier, you do not need to run this command. + Skip this step if you are using Laravel 10.x since the file that + the command generates already exists. Import the controller and add an API route that calls the ``store()`` method in the ``routes/api.php`` file: From 23c2252c43cd4fa5dedef72d660335cd761ed440 Mon Sep 17 00:00:00 2001 From: Chris Cho Date: Wed, 27 Mar 2024 13:33:43 -0400 Subject: [PATCH 4/5] remove tree link --- docs/quick-start.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/quick-start.txt b/docs/quick-start.txt index c9bb6a203..fb8ad6fe2 100644 --- a/docs/quick-start.txt +++ b/docs/quick-start.txt @@ -53,7 +53,7 @@ that connects to a MongoDB deployment. .. tip:: You can download the complete web application project by cloning the - `laravel-quickstart `__ + `laravel-quickstart `__ GitHub repository. .. button:: Next: Download and Install From 501dcd56aa6cc6503eee9481a55d34cd5c741fb1 Mon Sep 17 00:00:00 2001 From: Chris Cho Date: Wed, 27 Mar 2024 14:32:35 -0400 Subject: [PATCH 5/5] PRR fixes --- docs/quick-start/write-data.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/quick-start/write-data.txt b/docs/quick-start/write-data.txt index a2a99422f..ddf2a98d9 100644 --- a/docs/quick-start/write-data.txt +++ b/docs/quick-start/write-data.txt @@ -40,7 +40,7 @@ Write Data to MongoDB .. tip:: - Skip this step if you are using Laravel 10.x since the file that + Skip this step if you are using Laravel 10.x because the file that the command generates already exists. Import the controller and add an API route that calls the ``store()``