質問編集履歴
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -87,3 +87,49 @@
|
|
87
87
|
|
88
88
|
拙いつまづきかと思いますが、よろしくお願いいたします。
|
89
89
|
|
90
|
+
追記1)
|
91
|
+
```store
|
92
|
+
public function store(ItemRequest $request)
|
93
|
+
{
|
94
|
+
$item = new Item();
|
95
|
+
$item->item_name = $request->item_name;
|
96
|
+
$item->price = $request->price;
|
97
|
+
$item->description = $request->description;
|
98
|
+
|
99
|
+
$item->local_path1 = $request->local_path1;
|
100
|
+
if ($request->hasFile('local_path1')) {
|
101
|
+
$image_path = $request->file('local_path1')->store('public/tea/');
|
102
|
+
$item->uploaded_path1 = basename($image_path);
|
103
|
+
}
|
104
|
+
$item->local_path2 = $request->local_path2;
|
105
|
+
if ($request->hasFile('local_path2')) {
|
106
|
+
$image_path = $request->file('local_path2')->store('public/tea/');
|
107
|
+
$item->uploaded_path2 = basename($image_path);
|
108
|
+
}
|
109
|
+
$item->local_path3 = $request->local_path3;
|
110
|
+
if ($request->hasFile('local_path3')) {
|
111
|
+
$image_path = $request->file('local_path3')->store('public/tea/');
|
112
|
+
$item->uploaded_path3 = basename($image_path);
|
113
|
+
}
|
114
|
+
$item->local_path4 = $request->local_path4;
|
115
|
+
if ($request->hasFile('local_path4')) {
|
116
|
+
$image_path = $request->file('local_path4')->store('public/tea/');
|
117
|
+
$item->uploaded_path4 = basename($image_path);
|
118
|
+
}
|
119
|
+
$item->local_path5 = $request->local_path5;
|
120
|
+
if ($request->hasFile('local_path5')) {
|
121
|
+
$image_path = $request->file('local_path5')->store('public/tea/');
|
122
|
+
$item->uploaded_path5 = basename($image_path);
|
123
|
+
}
|
124
|
+
$item->local_path6 = $request->local_path6;
|
125
|
+
if ($request->hasFile('local_path6')) {
|
126
|
+
$image_path = $request->file('local_path6')->store('public/tea/');
|
127
|
+
$item->uploaded_path6 = basename($image_path);
|
128
|
+
}
|
129
|
+
|
130
|
+
$item->save();
|
131
|
+
|
132
|
+
return redirect()
|
133
|
+
->route('item.index');
|
134
|
+
}
|
135
|
+
```
|