laravel many to many relationship between 3 tables -


i have 3 tables category,product , store.one product can in multiple categories , store can have multiple categories , product.

i know how setup many-to-many relationship between 2 tables in laravel using pivot tables.however,regarding 3 tables,its getting bit complicated.what best approach setup many-to-many relationship between 3 tables using laravel framework ?

the answer question available in laravel official documentation, use many-to-many polymorphic relationships within laravel in kind of situation.

assuming you're using laravel 5.2, details in link: https://laravel.com/docs/5.2/eloquent-relationships#many-to-many-polymorphic-relations

please let me know if have confusions.


Comments