Skip to content

DOCSP-38076 quickstart updates for 11 #2799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/quick-start.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ that connects to a MongoDB deployment.
.. tip::

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

.. button:: Next: Download and Install
Expand Down
11 changes: 8 additions & 3 deletions docs/quick-start/configure-mongodb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: is this the correct file name? I only see an app.php file and a cache folder in the bootstrap directory

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking.
Yes, this is the correct file and path. I think you might be looking at Laravel 10.x, but this is for 11.x. The Laravel 11.x docs refer to this file here:
https://laravel.com/docs/11.x/providers#registering-providers

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 <https://laravel.com/docs/10.x/providers#registering-providers>`__.

After completing these steps, your Laravel web application is ready to
connect to MongoDB.

Expand Down
14 changes: 7 additions & 7 deletions docs/quick-start/view-data.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 14 additions & 3 deletions docs/quick-start/write-data.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -42,7 +53,7 @@ Write Data to MongoDB
// ...

Route::resource('movies', MovieController::class)->only([
'store'
'store'
]);


Expand All @@ -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
Expand Down