Skip to content

Commit eae3ba2

Browse files
committed
LM PR fixes 1
1 parent 6520c2f commit eae3ba2

File tree

4 files changed

+36
-25
lines changed

4 files changed

+36
-25
lines changed

docs/cache.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Cache and Locks
1414
Configuration
1515
-------------
1616

17-
To use MongoDB as a backend for `Laravel Cache and Locks <https://laravel.com/docs/{+laravel-docs-version+}/cache>`__,
17+
To use MongoDB as a back end for `Laravel Cache and Locks <https://laravel.com/docs/{+laravel-docs-version+}/cache>`__,
1818
add a store configuration by specifying the ``mongodb`` driver in ``config/cache.php``:
1919

2020
.. code-block:: php

docs/fundamentals/atlas-search.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ following optional parameters to ``search()``:
179179
* - ``returnStoredSource``
180180
- ``bool``
181181
- Specifies whether to perform a full document lookup on the
182-
backend database or return only stored source fields directly
182+
back end database or return only stored source fields directly
183183
from Atlas Search
184184

185185
* - ``tracking``

docs/index.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _laravel-docs-landing:
2+
13
===============
24
{+odm-long+}
35
===============

docs/quick-start/backend-service-tutorial.txt

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,20 @@ Tutorial: Build a Back End Service by Using {+odm-long+}
1010

1111
.. meta::
1212
:keywords: php framework, odm, code example, crud
13-
:description: Learn how to set up a back end and perform CRUD operations by using Laravel MongoDB .
13+
:description: Learn how to set up a back end and perform CRUD operations by using Laravel MongoDB.
1414

1515
.. contents:: On this page
1616
:local:
1717
:backlinks: none
18-
:depth: 1
18+
:depth: 2
1919
:class: singlecol
2020

2121
Overview
2222
--------
2323

2424
In this tutorial, you create a simple REST back end for a front-end app
25-
by using {+odm-long+}. The tutorial uses Laravel's built-in API routing.
25+
by using {+odm-long+}. The tutorial uses Laravel's built-in API routing
26+
features.
2627

2728
Prerequisites
2829
-------------
@@ -73,8 +74,10 @@ Steps
7374

7475
php artisan serve
7576

76-
Navigate to http://127.0.0.1:8000/info to view the PHPinfo page.
77-
Verify that the {+php-extension+} is installed.
77+
After the application begins running, navigate to
78+
http://127.0.0.1:8000/info to view the PHPinfo page. Scroll down
79+
to or search for the **mongodb** entry to verify that
80+
the {+php-extension+} is installed.
7881

7982
Run the following command in your shell to install {+odm-long+}:
8083

@@ -85,20 +88,21 @@ Steps
8588
.. step:: Configure your MongoDB connection.
8689

8790
Open your project's ``config/database.php`` file and update the
88-
``connection`` array as shown in the following code:
91+
``connections`` array as shown in the following code:
8992

9093
.. code-block:: php
9194

9295
'connections' => [
9396
'mongodb' => [
9497
'driver' => 'mongodb',
95-
'dsn' => env('MONGODB_URI'),
96-
'database' => '<database name>',
98+
'dsn' => env('MONGODB_URI', '<connection string>'),
99+
'database' => 'db',
97100
],
98101

99-
Ensure that you set the ``MONGODB_URI`` environment variable to
102+
Ensure that you either replace the connection string placeholder
103+
in the preceding code or set the ``MONGODB_URI`` environment variable to
100104
your connection string before you run your application. To learn
101-
more about locating your connection string, see
105+
how to locate your connection string, see
102106
:ref:`laravel-quick-start-connection-string` in the Quick Start
103107
guide.
104108

@@ -107,9 +111,10 @@ Steps
107111

108112
.. code-block:: php
109113

110-
'default' => env('DB_CONNECTION', 'mongodb'),
114+
'default' => 'mongodb',
111115

112-
The Laravel application can now connect to a MongoDB database.
116+
The Laravel application can now connect to the ``db`` database in
117+
your MongoDB cluster.
113118

114119
.. step:: Create an endpoint to ping your deployment.
115120

@@ -138,23 +143,27 @@ Steps
138143
return ['msg' => $msg];
139144
});
140145

141-
Verify that http://127.0.0.1:8000/api/ping shows the succesful
142-
ping message.
146+
Reload the application, then verify that
147+
http://127.0.0.1:8000/api/ping shows the succesful ping message.
143148

144149
.. step:: Create Eloquent models.
145150

146151
Laravel is integrated with Eloquent, an ORM that abstracts the
147-
database backend so that you can connect to different databases by
152+
database back end so that you can connect to different databases by
148153
using a common interface.
149154

150155
Eloquent provides a ``Model`` class to serve as the interface
151156
between your code and a specific collection. Instances of the
152157
``Model`` classes represent rows of tables in relational
153158
databases. In MongoDB, they are documents in the collection.
154159

155-
Your models can define fillable fields if you want to enforce a
156-
document schema in your application and prevent errors such as name
157-
typos.
160+
.. tip::
161+
162+
You can define fillable fields in your Eloquent models
163+
to enforce a document schema in your application and prevent
164+
errors such as name typos. To learn more, see the
165+
:ref:`laravel-model-mass-assignment` section of the Eloquent
166+
Model Class guide.
158167

159168
Create an Eloquent model called ``CustomerMongoDB`` by running
160169
the following command from the project root:
@@ -244,8 +253,8 @@ Steps
244253
the ``embedsMany()`` and ``embedsOne()`` methods.
245254

246255
As shown in the preceding step, you can define top-level schema
247-
attributes. However, it is more complicated when using arrays
248-
and embedded documents.
256+
attributes. However, it is more complicated when to define these
257+
attribute if your documents include arrays and embedded documents.
249258

250259
You can create the model's data structures in PHP. In the
251260
following example, the ``address`` field is an object type.
@@ -461,13 +470,13 @@ Conclusion
461470

462471
In this tutorial, you learned how to create a back-end service by using
463472
Laravel and MongoDB for a front-end web application.
464-
This tutorial also showed why the document model leads to higher
473+
This tutorial also showed how you can use the document model to improve
465474
database efficiency and scalability. You can use the document model with the
466475
MongoDB Query API to create better apps with less downtime.
467476

468477
You can access the full code for this tutorial in the
469478
:github:`laravel-mongodb-tutorial
470479
</mongodb-developer/laravel-mongodb-tutorial/>` repository on GitHub.
471480

472-
See the :ref:`laravel_fundamentals` guides to learn more about
473-
{+odm-long+}'s features.
481+
Navigate through the rest of the :ref:`laravel-docs-landing`
482+
documentation to learn more about {+odm-long+}'s features.

0 commit comments

Comments
 (0)