D
D
Dmitry2014-08-05 00:19:55
Database design
Dmitry, 2014-08-05 00:19:55

How to create pivot tables in Laravel?

I am developing an application in Laravel, with a many-to-many relationship.
Do I understand correctly: I only need to create source tables (using php artisan migrate), and linking tables are set using methods on Eloquent entities and the framework will create them itself?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Sokolov, 2014-08-05
@eX1stenZ

laravel.ru/articles/odd_bod/eloquent-tutorial read this manual, it describes in detail how to use Many-to-Many.
Based on the question, I understand that you rely on magic, and you think that Eloquent will create for you all the necessary tables for communication? Or I didn't understand the question?
One way or another, if I understood correctly, then you just need to create tables, whether it be migrations or regular PhpMyAdmin. And in Eloquent you specify exactly where to look when referring to many-to-many

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question