0
有人可以请解释hasManyThrough如何涉及我想要达到的sql语句吗?Laravel 5.4 hasManyThrough
--offers table
id, network_id, mobile_id
--networks table
id, name
--mobiles table
id, name
我试图让手机与::(“网络”)
我会写为
SELECT DISTINCT networks.name from networks, offers where offers.network_id = networks.id and offers.mobile_id in (1,2,3,4)
关于上述SQL语句哪里各精氨酸直播hasManyThrough方法?即
hasManyThrough(Network::class,Offer::class,'network_id','mobile_id')
我试图避免一个额外的数据透视表,因为offer表是一个包含所有需要的id的数据透视表,但我认为你是对的,谢谢。 – futureweb