mercredi 31 octobre 2018

Laravel Eloquent triple Relationship

I am stuck in situation where I need relation between 3 different tables. My tables are companies, products and Roles. Companies can assign multiple Roles to multiple products. The problem is Companies do not have any relationship with products. Products are added through admin.

Currently I have made a table company_product_role with structure company_id, product_id and role_id, the problem is how to make eloquent relation for insertion and retrieval. Either I am doing it correct or there is simple solution for it?

Any help will be appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire