-
Notifications
You must be signed in to change notification settings - Fork 1.5k
DOCSP-37618: Usage Examples landing page #2767
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
Changes from 8 commits
44a0f86
afc83e1
f97fbb3
79a19c0
6edfb45
2885cc5
301ff74
f08b2be
e3af41b
6b0e08f
fc7970d
9034064
ab90497
9e0b2dc
7544220
fdca1ba
7aa61f9
8c3905c
245412f
e92f51b
2fe5eb9
9faa171
d2d9c9c
7ad6bdc
27dd0dd
9912b50
64afec5
fc06d29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
.. _laravel-usage-examples: | ||
|
||
============== | ||
Usage Examples | ||
============== | ||
|
||
.. facet:: | ||
:name: genre | ||
:values: tutorial | ||
|
||
.. meta:: | ||
:keywords: set up, runnable, code example | ||
|
||
.. contents:: On this page | ||
:local: | ||
:backlinks: none | ||
:depth: 1 | ||
:class: singlecol | ||
|
||
Overview | ||
-------- | ||
|
||
Usage examples show runnable code examples to demonstrate frequently used MongoDB | ||
operations. Each usage example includes the following components: | ||
|
||
- Explanation of the MongoDB operation | ||
- Example controller code that runs the MongoDB operation | ||
- Example view code that renders the result | ||
- Output displayed by the view | ||
|
||
How to Run the Usage Examples | ||
----------------------------- | ||
|
||
The usage examples are designed to run operations on a MongoDB deployment that contains | ||
the MongoDB Atlas sample datasets. When you run the example code without this sample data, | ||
the output might not match. | ||
|
||
You can run the usage examples from the Laravel web application and MongoDB Atlas cluster that you | ||
set up in the :ref:`laravel-quick-start` guide. After completing the Quick Start, ensure that your | ||
application meets the following requirements: | ||
|
||
- Connects to the ``movies`` collection in the Atlas sample datasets | ||
- Contains the ``MovieController.php`` and ``browse_movies.blade.php`` files | ||
|
||
Then, follow this tutorial to add the usage example code to your Laravel application and view | ||
the expected results. | ||
|
||
.. procedure:: | ||
:style: connected | ||
|
||
.. step:: Add the Controller Code to Your Application | ||
|
||
Copy the example code from the :guilabel:`Controller File Code` tab on the usage example | ||
page and paste it into the ``MovieController.php`` file. | ||
|
||
.. step:: Add the View Code to Your Application | ||
|
||
Copy the example code from the :guilabel:`View File Code` tab on the usage example page and | ||
paste it into the ``browse_movies.blade.php`` file. | ||
|
||
.. step:: Run the Usage Example Code | ||
|
||
To run the example controller code and view the results, follow the instructions on the | ||
usage example page. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: I think presenting this information might not make sense before a reader gets the chance to see a Usage Example page. As mentioned in a previous comment, it should delegate some of the explanation to the specific usage examples since they may differ depending on the operation. Start with information on when this applies, e.g. Unless otherwise specified, you can add Usage Example sample code to your application by performing the following actions:
Follow the instructions on the Usage Example page to run the code and view the output. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah okay, so including tutorial steps doesn't seem necessary; changed |
||
|
||
After completing these steps, you can see the output described in the **Expected Output** section | ||
of the corresponding usage example. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
I think it could be easier to verify the requirements as Laravel web app components rather than existence of the collection and files. I think it's also missing mention of the API controller (used for storing data - see https://www.mongodb.com/docs/drivers/php/laravel-mongodb/current/quick-start/write-data/). E.g.
"... application contains the following components:"
Movie
model configured to use the MongoDB databaseMovie
view that lists the resultsMovie
data"