回答編集履歴
2
修正
answer
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
`updateOrCreate`メソッドを使うか、ユーザーIDで検索かけてなければ`create`、あれば`update`メソッドを実行するような処理を書けばいいのかなと
|
2
2
|
|
3
3
|
```php
|
4
|
-
App\
|
4
|
+
App\Introduction::updateOrCreate(['user_id' => $user->id],$reqest->all());
|
5
5
|
|
6
6
|
```
|
7
7
|
|
8
|
-
参考:[Eloquent:利用の開始 5.6 Laravel](https://readouble.com/laravel/5.6/ja/eloquent.html)
|
8
|
+
参考:[Eloquent:利用の開始 5.6 Laravel](https://readouble.com/laravel/5.6/ja/eloquent.html)
|
9
|
+
|
10
|
+
(レコードのことだとは思いますがテーブルはなければ作成するもんじゃなくて予め作成しておくものです)
|
1
参考URL追加
answer
CHANGED
@@ -3,4 +3,6 @@
|
|
3
3
|
```php
|
4
4
|
App\User::updateOrCreate(['user_id' => $user->id],$reqest->all());
|
5
5
|
|
6
|
-
```
|
6
|
+
```
|
7
|
+
|
8
|
+
参考:[Eloquent:利用の開始 5.6 Laravel](https://readouble.com/laravel/5.6/ja/eloquent.html)
|