File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -458,7 +458,7 @@ Cross-Database Relationship Example
458
458
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
459
459
460
460
The following example class creates a ``hasMany`` relationship between a
461
- ``SpaceShip`` model stored in a MySQL database and a ``Passenger`` model
461
+ ``SpaceShip`` model stored in a relational database and a ``Passenger`` model
462
462
stored in a MongoDB database:
463
463
464
464
.. literalinclude:: /includes/eloquent-models/relationships/SpaceShipCrossHasMany.php
@@ -472,6 +472,16 @@ The ``Passenger`` model defines a ``BelongsToMany`` relationship with
472
472
:language: php
473
473
:dedent:
474
474
475
+ .. tip::
476
+
477
+ Make sure that your primary key defined in your relational database table
478
+ schema matches the one that your model uses. To learn more about Laravel
479
+ primary keys and schema definitions, see the following pages in the Laravel
480
+ documentation:
481
+
482
+ - `Primary Keys <https://laravel.com/docs/{+laravel-docs-version+}/eloquent#primary-keys>`__
483
+ - `Database: Migrations <https://laravel.com/docs/{+laravel-docs-version+}/migrations>`__
484
+
475
485
The following sample code shows how to create a ``SpaceShip`` model in
476
486
a MySQL database and related ``Passenger`` models in a MongoDB database and
477
487
the data created by running the code. Click the :guilabel:`View Output` button
You can’t perform that action at this time.
0 commit comments