質問編集履歴
2
訂正
title
CHANGED
File without changes
|
body
CHANGED
@@ -53,14 +53,9 @@
|
|
53
53
|
{
|
54
54
|
return $this->belongsToMany('App\User', 'follows', 'follow_user_id', 'user_id');
|
55
55
|
}
|
56
|
-
//相互フォローを取得
|
57
|
-
public function mutual_users()
|
58
|
-
{
|
59
|
-
return $this->belongsToMany('App\User', 'follows', 'follow_user_id', 'user_id')->wherePivot('user_id', $this->id);
|
60
|
-
}
|
61
56
|
```
|
57
|
+
相互フォローの取得は複雑になりそうです。
|
62
58
|
|
63
|
-
|
64
59
|
### その他疑問
|
65
60
|
・[Laravelでいいね機能を作ってみた](https://qiita.com/daijiro_maeyama/items/e2aa608a0b49cff10969)
|
66
61
|
この記事のように「いいね」実装に多対多を使わない例を見るのですが、どちらが良いでしょうか?
|
1
追記事項
title
CHANGED
File without changes
|
body
CHANGED
@@ -53,9 +53,14 @@
|
|
53
53
|
{
|
54
54
|
return $this->belongsToMany('App\User', 'follows', 'follow_user_id', 'user_id');
|
55
55
|
}
|
56
|
+
//相互フォローを取得
|
57
|
+
public function mutual_users()
|
58
|
+
{
|
59
|
+
return $this->belongsToMany('App\User', 'follows', 'follow_user_id', 'user_id')->wherePivot('user_id', $this->id);
|
60
|
+
}
|
56
61
|
```
|
57
|
-
相互フォローはどうやって取得するんですかね。
|
58
62
|
|
63
|
+
|
59
64
|
### その他疑問
|
60
65
|
・[Laravelでいいね機能を作ってみた](https://qiita.com/daijiro_maeyama/items/e2aa608a0b49cff10969)
|
61
66
|
この記事のように「いいね」実装に多対多を使わない例を見るのですが、どちらが良いでしょうか?
|