@@ -32,7 +32,7 @@ related model by using the same syntax as you use to access a property on the
32
32
model.
33
33
34
34
The following sections describe the Laravel Eloquent and MongoDB-specific
35
- relationships available in {+odm-short+} and shows examples of how to define
35
+ relationships available in {+odm-short+} and show examples of how to define
36
36
and use them:
37
37
38
38
- :ref:`One to one relationship <laravel-eloquent-relationship-one-to-one>`,
@@ -141,9 +141,9 @@ the parent and one or more related child model records.
141
141
142
142
When you add a one to many relationship method, Eloquent lets you access the
143
143
model by using a dynamic property and stores the parent model's document ID
144
- on each of the child model documents .
144
+ on each child model document .
145
145
146
- In {+odm-short+}, you can define a one to many relationship by using the
146
+ In {+odm-short+}, you can define a one to many relationship by adding the
147
147
``hasMany()`` method on the parent class and, optionally, the ``belongsTo()``
148
148
method on the child class.
149
149
@@ -240,7 +240,7 @@ In {+odm-short+}, you can define a many to many relationship by adding the
240
240
When you define a many to many relationship in a relational database, Laravel
241
241
creates a pivot table to track the relationships. When you use {+odm-short+},
242
242
it omits the pivot table creation and adds the related document IDs to a
243
- document field, derived from the related model class name.
243
+ document field derived from the related model class name.
244
244
245
245
.. tip::
246
246
@@ -259,7 +259,7 @@ Many to Many Example
259
259
~~~~~~~~~~~~~~~~~~~~
260
260
261
261
The following example class shows how to define a ``BelongsToMany`` many to
262
- many relationship between a ``Planet`` and ``SpaceExporer `` model by using
262
+ many relationship between a ``Planet`` and ``SpaceExplorer `` model by using
263
263
the ``belongsToMany()`` method:
264
264
265
265
.. literalinclude:: /includes/eloquent-models/relationships/many-to-many/Planet.php
@@ -365,8 +365,8 @@ to meet one or more of the following requirements:
365
365
data
366
366
- Reducing the number of reads required to fetch the data
367
367
368
- In {+odm-short+}, you can define embedded documents by using one of the
369
- following dynamic property methods:
368
+ In {+odm-short+}, you can define embedded documents by adding one of the
369
+ following methods:
370
370
371
371
- ``embedsOne()`` to embed a single document
372
372
- ``embedsMany()`` to embed multiple documents
@@ -388,8 +388,9 @@ pattern.
388
388
Embedded Document Example
389
389
~~~~~~~~~~~~~~~~~~~~~~~~~
390
390
391
- The following example class shows how to define an ``embedsMany`` one to many
392
- relationship between a ``SpaceShip`` and ``Cargo`` model:
391
+ The following example class shows how to define an ``EmbedsMany`` one to many
392
+ relationship between a ``SpaceShip`` and ``Cargo`` model by using the
393
+ ``embedsMany()`` method:
393
394
394
395
.. literalinclude:: /includes/eloquent-models/relationships/embeds/SpaceShip.php
395
396
:language: php
@@ -446,7 +447,7 @@ Cross-Database Relationships
446
447
----------------------------
447
448
448
449
A cross-database relationship in {+odm-short+} is a relationship between models
449
- stored in a SQL relational database and models stored in a MongoDB database.
450
+ stored in a relational database and models stored in a MongoDB database.
450
451
451
452
When you add a cross-database relationship, Eloquent lets you access the
452
453
related models by using a dynamic property.
@@ -485,7 +486,7 @@ model by using the ``belongsTo()`` method:
485
486
486
487
.. tip::
487
488
488
- Make sure that your primary key defined in your relational database table
489
+ Make sure that the primary key defined in your relational database table
489
490
schema matches the one that your model uses. To learn more about Laravel
490
491
primary keys and schema definitions, see the following pages in the Laravel
491
492
documentation:
@@ -494,8 +495,8 @@ model by using the ``belongsTo()`` method:
494
495
- `Database: Migrations <https://laravel.com/docs/{+laravel-docs-version+}/migrations>`__
495
496
496
497
The following sample code shows how to create a ``SpaceShip`` model in
497
- a MySQL database and related ``Passenger`` models in a MongoDB database and
498
- the data created by running the code. Click the :guilabel:`VIEW OUTPUT` button
498
+ a MySQL database and related ``Passenger`` models in a MongoDB database as well
499
+ as the data created by running the code. Click the :guilabel:`VIEW OUTPUT` button
499
500
to see the data created by running the code:
500
501
501
502
.. io-code-block::
0 commit comments