diff --git a/docs/quick-start.txt b/docs/quick-start.txt index d672f3e31..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 diff --git a/docs/quick-start/configure-mongodb.txt b/docs/quick-start/configure-mongodb.txt index 66cd2380c..2f6dd0e36 100644 --- a/docs/quick-start/configure-mongodb.txt +++ b/docs/quick-start/configure-mongodb.txt @@ -41,15 +41,20 @@ 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, + .. 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. 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..ddf2a98d9 100644 --- a/docs/quick-start/write-data.txt +++ b/docs/quick-start/write-data.txt @@ -32,6 +32,17 @@ 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:: + + 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()`` method in the ``routes/api.php`` file: @@ -42,7 +53,7 @@ Write Data to MongoDB // ... Route::resource('movies', MovieController::class)->only([ - 'store' + 'store' ]); @@ -57,8 +68,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