Recent Activity




小辣辣
User for 8 years
Viewer
5 years ago 评论 进阶篇(八):Eloquent 模型关联关系(中)我后面想了个办法 我用的是laravel-admin后台模板,使用保存后事件去监听 再去进行更新数据表字段。
5 years ago 评论 进阶篇(八):Eloquent 模型关联关系(中)我文章跟标签是使用多对对的方式,就是一个文章可以有多个标签,一个标签也可以被多个文章使用。在文章模型中使用belongsToMany()这个多对多的方式来关联起来,这样就可以在添加编辑的时候 ...
5 years ago 评论 进阶篇(八):Eloquent 模型关联关系(中)是的,是的。理解,我的意思呢就是想把他们这些关联的ID全塞到中间表去做统一管理,哈哈哈?。感谢学院君
5 years ago 评论 进阶篇(八):Eloquent 模型关联关系(中)可是这样的话 文章类目ID不会写入中间表 而会直接写入文章表中。
5 years ago 评论 进阶篇(八):Eloquent 模型关联关系(中)在article模型中 标签对中间表的关联是多对多:return $this->belongsToMany(Tag::class,'article_tags','article_id','...