Defining relationships among database tables with Eloquent @ blog.andreasartori.me

One very clever article showing all types of complicated relations that you may stumble upon in your job.

The author shows in a very clean way how to create such migrations, seeds and models.

Check out how morphs(), morphTo(), morphToMany(), morphedByMany and withPivot() are used.

Read it a couple of times, test it with all possible databases Laravel supports and see the differences, check the structure created: tables, data, foreign keys. Add, delete records and see what happens inside the database. Try creating your own app using these functions to get even more clear picture.

Laravel, Eloquent, polymorphism, one-to-many, many-to-many and polymorphic many-to-many relationships:

Defining relationships among database tables with Eloquent.

Put your GitLab on HTTPS

For this article I will use the following configuration:GitLab Docker image by sameersbn ...

Learn more

About Iliyan Trifonov

Web Developer, Blogger
Tagged , , , , , , , , , . Bookmark the permalink.
  • Andrea Marco Sartori

    Thanks for sharing, Iliyan 🙂