質問編集履歴
1
bladeを追加しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -154,6 +154,150 @@
|
|
154
154
|
|
155
155
|
```
|
156
156
|
|
157
|
+
```ListBlade
|
158
|
+
|
159
|
+
@extends('product.layout')
|
160
|
+
|
161
|
+
@section('title', '商品一覧')
|
162
|
+
|
163
|
+
@section('content')
|
164
|
+
|
165
|
+
<div class="row">
|
166
|
+
|
167
|
+
<div class="input-group">
|
168
|
+
|
169
|
+
<form class="form-inline" action="{{ route('search') }}" method="get">
|
170
|
+
|
171
|
+
<input name="search" value="" type="text" class="form-control input-lg" placeholder="商品名">
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
<select class="form-control" name="search">
|
176
|
+
|
177
|
+
<option selected disabled>メーカー名</option>
|
178
|
+
|
179
|
+
@foreach($products as $product)
|
180
|
+
|
181
|
+
<option id="company_id" name="company_id" value="{{ $product->id }}">{{ $product->company_name }}</option>
|
182
|
+
|
183
|
+
@endforeach
|
184
|
+
|
185
|
+
</select>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
<button type="submit" class="btn btn-primary">検索</button>
|
190
|
+
|
191
|
+
</form>
|
192
|
+
|
193
|
+
</div>
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
<div class="mb-5 col-md-10 col-md-offset-2">
|
198
|
+
|
199
|
+
<h2 class="text-secondary mt-3">商品一覧</h2>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
@isset($search_result)
|
204
|
+
|
205
|
+
<p class="text-danger">{{ $search_result }}</p>
|
206
|
+
|
207
|
+
@endisset
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
@if (session('err_msg'))
|
212
|
+
|
213
|
+
<p class="text-danger">{{ session('err_msg') }}</p>
|
214
|
+
|
215
|
+
@endif
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
<table class="table table-striped text-secondary">
|
220
|
+
|
221
|
+
<tr>
|
222
|
+
|
223
|
+
<th>ID</th>
|
224
|
+
|
225
|
+
<th>商品画像</th>
|
226
|
+
|
227
|
+
<th>商品名</th>
|
228
|
+
|
229
|
+
<th>価格</th>
|
230
|
+
|
231
|
+
<th>在庫数</th>
|
232
|
+
|
233
|
+
<th>メーカー名</th>
|
234
|
+
|
235
|
+
<th></th>
|
236
|
+
|
237
|
+
<th></th>
|
238
|
+
|
239
|
+
</tr>
|
240
|
+
|
241
|
+
@foreach($products as $product)
|
242
|
+
|
243
|
+
<tr>
|
244
|
+
|
245
|
+
<td>{{ $product->id }}</td>
|
246
|
+
|
247
|
+
<td><img src="{{ asset('/storage/' . $product->image) }}" class="img-fluid" alt="{{ $product->image }}" width="200" height="200"></td>
|
248
|
+
|
249
|
+
<td>{{ $product->product_name }}</td>
|
250
|
+
|
251
|
+
<td>{{ $product->price }}</td>
|
252
|
+
|
253
|
+
<td>{{ $product->stock }}</td>
|
254
|
+
|
255
|
+
<td>{{ $product->company_name }}</td>
|
256
|
+
|
257
|
+
<td><button type="button" class="btn btn-primary" onclick="location.href='/product/detail/{{ $product->id }}'">詳細</button></td>
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
<form method="POST" action="{{ route('delete', $product->id) }}" onSubmit="return checkDelete()">
|
262
|
+
|
263
|
+
@csrf
|
264
|
+
|
265
|
+
<td><button type="submit" class="btn btn-secondary" onclick=>削除</button></td>
|
266
|
+
|
267
|
+
</form>
|
268
|
+
|
269
|
+
</tr>
|
270
|
+
|
271
|
+
@endforeach
|
272
|
+
|
273
|
+
</table>
|
274
|
+
|
275
|
+
</div>
|
276
|
+
|
277
|
+
</div>
|
278
|
+
|
279
|
+
<script>
|
280
|
+
|
281
|
+
function checkDelete(){
|
282
|
+
|
283
|
+
if(window.confirm('削除してよろしいですか?')){
|
284
|
+
|
285
|
+
return true;
|
286
|
+
|
287
|
+
} else {
|
288
|
+
|
289
|
+
return false;
|
290
|
+
|
291
|
+
}
|
292
|
+
|
293
|
+
}
|
294
|
+
|
295
|
+
</script>
|
296
|
+
|
297
|
+
@endsection
|
298
|
+
|
299
|
+
```
|
300
|
+
|
157
301
|
### 補足情報(FW/ツールのバージョンなど)
|
158
302
|
|
159
303
|
Laravel5.8
|