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

ollie_123's avatar

3 Table Structure - To Pivot or Not to Pivot?

Hi All

I'm looking for a bit of advice on how to structure my tables. I'm creating a CRM where i would ideally not have to use separate pricebooks for all of the products as it then becomes a nightmare to maintain.

The models i have are

-Company
-ProductFamily (hasMany Product)
-Discount

A company can belongToMany ProductFamily A ProductFamily hasMany Discount

I was thinking of a pivot table between the three tables company_discount_family with a belongsToMany on each but i'm not sure if this is the best way.

The aim is when the user creates a quote against a company, it automatically selects the customer discount against the brand for each product.

I've been looking at it for a couple of days and i'm not sure if the Pivot table is the right solution.

Please could someone advise?

Thanks in advance.

0 likes
1 reply
ollie_123's avatar

Any advice would be greatly appreciated.

Thank you in advance.

Please or to participate in this conversation.