如何通过中间表进行 一对一 / 一对多 关联?
template:
id
category
id
template_category
template_id
cateogry_id
template -> category
如何一对一关联
category -> template
如何一对多关联
通过中间表的方式不太会。。。尝试过 hasOneThrough 和 belongsToMany 结果不太对劲
tips:历史表设计问题,中间表有其他数据
你这种表结构适用于 一对一 一对多 多对多
hasManyThrough
挺好用的就是这样用 我用的没啥问题