質問編集履歴

2

2021/08/10 06:44

投稿

teityann1225
teityann1225

スコア158

test CHANGED
File without changes
test CHANGED
@@ -167,3 +167,31 @@
167
167
  }
168
168
 
169
169
  ```
170
+
171
+
172
+
173
+ Create部分
174
+
175
+ ```
176
+
177
+ $report = Report::create([
178
+
179
+ "user_id" => Auth::id(),
180
+
181
+ "title" => $request->input('report-title'),
182
+
183
+ "description" => $request->input('report-description'),
184
+
185
+ "character_id" => $request->input('character'),
186
+
187
+ "game_mode_id" => $request->input('game_mode'),
188
+
189
+ "account_name" => $request->input('account-name', 'none'),
190
+
191
+ "is_account_name_null" => $request->input('cantReadCheck', false) == "on",
192
+
193
+ "time_unknown" => $request->input('unknown_time_check', false) == "on",
194
+
195
+ "occurrence_date" => $date, ]);
196
+
197
+ ```

1

uuidの設定箇所のコードを追記

2021/08/10 06:44

投稿

teityann1225
teityann1225

スコア158

test CHANGED
File without changes
test CHANGED
@@ -57,6 +57,26 @@
57
57
  return $query->where('report_uuid',$uuid)->first()->report_uuid;
58
58
 
59
59
  }
60
+
61
+
62
+
63
+ ** 省略**
64
+
65
+ protected static function boot(): void
66
+
67
+ {
68
+
69
+ parent::boot();
70
+
71
+ self::creating(function ($model){
72
+
73
+ $model->report_uuid = (string) Str::orderedUuid();
74
+
75
+ });
76
+
77
+ }
78
+
79
+
60
80
 
61
81
  ```
62
82