質問編集履歴
1
誤字
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
laravelにおける
|
1
|
+
laravelにおける一対多の関係
|
test
CHANGED
@@ -18,17 +18,9 @@
|
|
18
18
|
|
19
19
|
の2つのテーブルがあります。
|
20
20
|
|
21
|
-
|
21
|
+
userは複数のproductを持てる関係です。
|
22
22
|
|
23
23
|
|
24
|
-
|
25
|
-
product_userテーブル
|
26
|
-
|
27
|
-
・id
|
28
|
-
|
29
|
-
・product_id
|
30
|
-
|
31
|
-
・user_id
|
32
24
|
|
33
25
|
|
34
26
|
|
@@ -94,11 +86,11 @@
|
|
94
86
|
|
95
87
|
```php
|
96
88
|
|
97
|
-
public function user
|
89
|
+
public function user()
|
98
90
|
|
99
91
|
{
|
100
92
|
|
101
|
-
return $this->
|
93
|
+
return $this->belongsTo('App\User');
|
102
94
|
|
103
95
|
}
|
104
96
|
|