質問編集履歴
1
htmlを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -43,3 +43,121 @@
|
|
43
43
|
|
44
44
|
|
45
45
|
```
|
46
|
+
|
47
|
+
```ここに言語を入力
|
48
|
+
|
49
|
+
---------------list.blade.php---------------------
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
<form action="{{ route('find') }}" method="get">
|
54
|
+
|
55
|
+
<input type="text" name="product_name" value="" placeholder="商品名を入力してください">
|
56
|
+
|
57
|
+
<select name="company_id" value="{{ old('company_id') }}">
|
58
|
+
|
59
|
+
<option disabled selected value>メーカーを選択してください</option>
|
60
|
+
|
61
|
+
@foreach($companies as $company)
|
62
|
+
|
63
|
+
<option value="{{$company->id}}">{{$company->company_name}}</option>
|
64
|
+
|
65
|
+
@endforeach
|
66
|
+
|
67
|
+
</select>
|
68
|
+
|
69
|
+
<input type="submit" value="検索">
|
70
|
+
|
71
|
+
</form>
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
<div class="row">
|
76
|
+
|
77
|
+
<div class="col-md-10 col-md-offset-2">
|
78
|
+
|
79
|
+
<h2>商品一覧</h2>
|
80
|
+
|
81
|
+
@if (session('err_msg'))
|
82
|
+
|
83
|
+
<p class="text-danger">
|
84
|
+
|
85
|
+
{{ session('err_msg') }}
|
86
|
+
|
87
|
+
</p>
|
88
|
+
|
89
|
+
@endif
|
90
|
+
|
91
|
+
<table class="table table-striped">
|
92
|
+
|
93
|
+
<tr>
|
94
|
+
|
95
|
+
<th>id</th>
|
96
|
+
|
97
|
+
<th>商品画像</th>
|
98
|
+
|
99
|
+
<th>商品名</th>
|
100
|
+
|
101
|
+
<th>価格</th>
|
102
|
+
|
103
|
+
<th>在庫数</th>
|
104
|
+
|
105
|
+
<th>メーカー名</th>
|
106
|
+
|
107
|
+
<th></th>
|
108
|
+
|
109
|
+
</tr>
|
110
|
+
|
111
|
+
@foreach($products as $product)
|
112
|
+
|
113
|
+
<tr>
|
114
|
+
|
115
|
+
<td>{{ $product->id }}</td>
|
116
|
+
|
117
|
+
<td><img src="{{ asset('storage/' . $product['product_image']) }}" width="30" height="100"></td>
|
118
|
+
|
119
|
+
<td><a href="/home/{{ $product->id }}">{{ $product->product_name }}</a></td>
|
120
|
+
|
121
|
+
<td>{{ $product->price }}</td>
|
122
|
+
|
123
|
+
<td>{{ $product->stock }}</td>
|
124
|
+
|
125
|
+
<td>{{ $product->company->company_name }}</td>
|
126
|
+
|
127
|
+
<form method="POST" action="{{ route('delete', $product->id) }}" onSubmit="return checkDelete()">
|
128
|
+
|
129
|
+
@csrf
|
130
|
+
|
131
|
+
<th><button type="submit" class="btn btn-primary" onclick=>削除</button></th>
|
132
|
+
|
133
|
+
</form>
|
134
|
+
|
135
|
+
</tr>
|
136
|
+
|
137
|
+
@endforeach
|
138
|
+
|
139
|
+
</table>
|
140
|
+
|
141
|
+
</div>
|
142
|
+
|
143
|
+
</div>
|
144
|
+
|
145
|
+
<script>
|
146
|
+
|
147
|
+
function checkDelete() {
|
148
|
+
|
149
|
+
if (window.confirm('削除してよろしいですか?')) {
|
150
|
+
|
151
|
+
return true;
|
152
|
+
|
153
|
+
} else {
|
154
|
+
|
155
|
+
return false;
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
</script>
|
162
|
+
|
163
|
+
```
|