回答編集履歴

2

参考サイト追記

2018/07/24 07:03

投稿

motuo
motuo

スコア3027

test CHANGED
@@ -71,3 +71,9 @@
71
71
 
72
72
 
73
73
  この関係を見ると、answersのid1番には、user_idが1と2の人が「イイネ」をしていて合計で2件のイイネが付いているとわかります。
74
+
75
+
76
+
77
+ あとは、`answer`モデルに`hasmany`で`favotites`をつけてあげれば、一覧の中でイイネの件数を簡単に出す事が出来るはず。
78
+
79
+ [参考](https://readouble.com/laravel/5.5/ja/eloquent-relationships.html#one-to-many)

1

IDを修正

2018/07/24 07:03

投稿

motuo
motuo

スコア3027

test CHANGED
@@ -64,9 +64,9 @@
64
64
 
65
65
  |1|1|1|
66
66
 
67
- |1|1|2|
67
+ |2|1|2|
68
68
 
69
- |1|2|1|
69
+ |3|2|1|
70
70
 
71
71
 
72
72