Laravel and Mysql three tables relationship

Multi tool use
Multi tool use


I need to add three tables to MySql but I don't know how to organize them.



My tables are :



And my relations :



Surfaces are enter after apartment, so I can't use surfaces floor as my apartment floor.



At the moment I have apartment table and floor table with a pivot table (many to many).



In Mysql, what's the best way to handle this ? And after inside laravel ?



Thank for yourhelp !



Edit : my work on laravel so far (only floor table and apartment table)



In Apartment.php :



In Floor.php :



Edit 2 : my migration so far :



I can think of below kind of relationships in Laravel, I have not created the sample code although but it should help.



Apartment model:



Floor model:



Surface model:



However, it will bring more clarity to the answers if you can provide table schema or migration schema on the same question. Also, you can mention which kinds of SQL queries you are expecting and want to execute. Thanks. Hope this helps.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

2ZmD,ZH 3,A,pS1qV7pvVvV0rbuetLFzx3vigb9i0N5xLiBW b,CCPaGkA7qcHM VN3 6WvmIc
NKsAkTU8nEM,1t35

Popular posts from this blog

The Dalles, Oregon

영화 미래의 미라이 다시보기 (2018) 다운로드 링크 무료보기

Chuyện tình của sao nam Cbiz đem lòng yêu quản lý: Người tìm được chân ái, kẻ vẫn chưa chịu thừa nhận