[英]Eloquent Relationships: user hasmany posts has many comments
Comment
可以同時屬於Post
和belongTo
。 因此,解決方案可能如下所示:
hasMany
帖子hasMany
評論belongsTo
用戶hasMany
評論belongTo
用戶belongsTo
帖子用戶 |
---|
ID |
郵政 |
---|
ID |
用戶身份 |
評論 |
---|
ID |
用戶身份 |
post_id |
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.