回答編集履歴
3
column名であることを明示
answer
CHANGED
@@ -9,4 +9,4 @@
|
|
9
9
|
Laravelのリレーションはtable名の単数形_idのcolumnを外部キーとして扱います。
|
10
10
|
(参考 [Eloquent:リレーション](https://readouble.com/laravel/8.x/ja/eloquent-relationships.html))
|
11
11
|
hr_idをhr_usersテーブルに対しての外部キーとして扱いたい場合は第2引数にその旨を明示しましょう。
|
12
|
-
もしくはhr_idをhr_user_idに
|
12
|
+
もしくはhr_idのcolumn名をhr_user_idに変更でもいけます。
|
2
改行位置変更
answer
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
}
|
7
7
|
```
|
8
8
|
|
9
|
+
Laravelのリレーションはtable名の単数形_idのcolumnを外部キーとして扱います。
|
9
|
-
|
10
|
+
(参考 [Eloquent:リレーション](https://readouble.com/laravel/8.x/ja/eloquent-relationships.html))
|
10
11
|
hr_idをhr_usersテーブルに対しての外部キーとして扱いたい場合は第2引数にその旨を明示しましょう。
|
11
12
|
もしくはhr_idをhr_user_idに名前変更でもいけます。
|
1
参考の翻訳ドキュメントを追加
answer
CHANGED
@@ -6,6 +6,6 @@
|
|
6
6
|
}
|
7
7
|
```
|
8
8
|
|
9
|
-
|
9
|
+
Laravelのリレーションはtable名の単数形_idのcolumnを外部キーとして扱います。([Eloquent:リレーション](https://readouble.com/laravel/8.x/ja/eloquent-relationships.html))
|
10
10
|
hr_idをhr_usersテーブルに対しての外部キーとして扱いたい場合は第2引数にその旨を明示しましょう。
|
11
11
|
もしくはhr_idをhr_user_idに名前変更でもいけます。
|