Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rachid_rafia's avatar

Need help with a crazy database structure

Ok, I have to admit. I thought I was good at designing databases until I encountered this problem. I'm working on a project where I need to create three Many-to-Many relationships between 4 models. Here is how it goes:

FAQ Categories can have many FAQ Subcategories and vice versa.

FAQ Groups can have many FAQ Subcategories and vice versa.

FAQs can have many FAQ groups and vice versa.

To all the database experts out there, how should I design this database schema in Laravel? Should I have three different pivot tables? Should I use polymorphic relationships? I've used polymorphic relationships before, but I'm struggling with implementing it in this scenario. Any help would be greatly appreciated.

Thank you,

0 likes
0 replies

Please or to participate in this conversation.