Skip to main content

Rare Cases of HasOne Relationship

Lesson 02/20 2:58
Autoplay
Vilior Alex avatar

Hi Povilas, i have a scenario with two tables, each table has around 60 colums. Those two tables share the same 50 columns. So i thought to group the 50 columns in 5 or 6 different tables with One-2-One Polymorphic relationship on the main table. My question is how do i structure the store method in the controller as you have first to create the main table and then the other table by as $originalTable->secondTable()->create([....]);. So how do i create the third, and forth table? Or should i structure my database in a complete different way? Hope you understand the way i explained it. Thank you in advance.

Povilas Korop avatar

Hi Vilior, such questions about the relationships are almost impossible to answer without actually trying it out and playing around with the structure whether it fits. So unfortunately I can't answer in a quick comment here.

Vilior Alex avatar

Thank you for your answer. That makes completely sense.

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.