質問編集履歴

4

2021/12/03 18:21

投稿

meron88
meron88

スコア50

test CHANGED
File without changes
test CHANGED
@@ -65,47 +65,3 @@
65
65
  ]
66
66
 
67
67
  ```
68
-
69
-
70
-
71
- ```php
72
-
73
-
74
-
75
- $menu = new Menu();
76
-
77
- $menu->menu_name = $request->menu_name;
78
-
79
- $menu->menu_cd = $request->menu_cd;
80
-
81
-
82
-
83
- foreach($request->store_cd as $val) {
84
-
85
- $menu->menuDetails()->createMany([
86
-
87
- ['menu_cd' => $val],
88
-
89
- ['store_cd' => $request->store_cd],
90
-
91
- ['user_id' => Auth::id()],
92
-
93
- ]);
94
-
95
- }
96
-
97
- $menu->save();
98
-
99
- ```
100
-
101
-
102
-
103
- ### 発生している問題・エラーメッセージ
104
-
105
-
106
-
107
- ```
108
-
109
- SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "user_id" violates not-null constraint DETAIL: Failing row contains (18, A11, 55, 2021-10-22 16:17:37, null).
110
-
111
- ```

3

タイトル変更

2021/12/03 18:21

投稿

meron88
meron88

スコア50

test CHANGED
@@ -1 +1 @@
1
- 1対多の登録処理につ
1
+ laravelの1対多の登録処理をした
test CHANGED
File without changes

2

変数名が間違えていた為修正

2021/10/22 07:42

投稿

meron88
meron88

スコア50

test CHANGED
File without changes
test CHANGED
@@ -106,6 +106,6 @@
106
106
 
107
107
  ```
108
108
 
109
- SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "update_user" violates not-null constraint DETAIL: Failing row contains (18, A11, 55, 2021-10-22 16:17:37, null).
109
+ SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "user_id" violates not-null constraint DETAIL: Failing row contains (18, A11, 55, 2021-10-22 16:17:37, null).
110
110
 
111
111
  ```

1

コードが間違えていた為修正

2021/10/22 07:41

投稿

meron88
meron88

スコア50

test CHANGED
File without changes
test CHANGED
@@ -78,10 +78,6 @@
78
78
 
79
79
  $menu->menu_cd = $request->menu_cd;
80
80
 
81
- $menu->create_user = Auth::id();
82
-
83
- $menu->update_user = Auth::id();
84
-
85
81
 
86
82
 
87
83
  foreach($request->store_cd as $val) {
@@ -92,7 +88,7 @@
92
88
 
93
89
  ['store_cd' => $request->store_cd],
94
90
 
95
- ['update_user' => Auth::id()],
91
+ ['user_id' => Auth::id()],
96
92
 
97
93
  ]);
98
94