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
458458~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
459459
460460The 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
462462stored in a MongoDB database:
463463
464464.. literalinclude:: /includes/eloquent-models/relationships/SpaceShipCrossHasMany.php
@@ -472,6 +472,16 @@ The ``Passenger`` model defines a ``BelongsToMany`` relationship with
472472 :language: php
473473 :dedent:
474474
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+
475485The following sample code shows how to create a ``SpaceShip`` model in
476486a MySQL database and related ``Passenger`` models in a MongoDB database and
477487the data created by running the code. Click the :guilabel:`View Output` button
You can’t perform that action at this time.
0 commit comments