2015-12-23 82 views
-3

嗨,我有一個表與多對多的關係。laravel與數據透視表新的多對多關係

樞紐

id | name 

country_hub

hub_id | country_id 

國家

id | name 

和另一個表

類別

id | name 

分類屬於hub_idcountry_id組合,又是一個多對多的關係透視表country_hub

country_hub_id | category_id 

請任何人可以建議我如何我是否管理這個。我是否應該製作另一個數據透視表category_country_hub,以及如何在Laravel中實施它?

哪一個是好辦法

category_country_hub

country_hub_id | category_id 

OR

category_country_hub

hub_id | country_id | category_id 
+0

爲什麼這個問題降級 – sanu

+0

可能是你沒有發佈你的嘗試,無論你迄今爲止已經嘗試或任何你已經做過的研究 –

+0

使用country_hub_id | category_id,因爲這會給你足夠的靈活性,並且規範化更容易。 – saopayne

回答

相關問題