質問編集履歴
1
誤字がありましたので修正しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -96,6 +96,208 @@
|
|
96
96
|
|
97
97
|
```
|
98
98
|
|
99
|
+
```MyreviewsController
|
100
|
+
|
101
|
+
<?php
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
namespace App\Http\Controllers;
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
use Illuminate\Http\Request;
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
use App\User;
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
class MyreviewsController extends Controller
|
118
|
+
|
119
|
+
{
|
120
|
+
|
121
|
+
public function index()
|
122
|
+
|
123
|
+
{
|
124
|
+
|
125
|
+
// ユーザ一覧をidの降順で取得
|
126
|
+
|
127
|
+
$users = User::orderBy('id', 'desc')->paginate(10);
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
// ユーザ一覧ビューでそれを表示
|
134
|
+
|
135
|
+
return view('reviews.review', [
|
136
|
+
|
137
|
+
'users' => $users,
|
138
|
+
|
139
|
+
]);
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
}
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
/**
|
148
|
+
|
149
|
+
* Show the form for creating a new resource.
|
150
|
+
|
151
|
+
*
|
152
|
+
|
153
|
+
* @return \Illuminate\Http\Response
|
154
|
+
|
155
|
+
*/
|
156
|
+
|
157
|
+
public function create()
|
158
|
+
|
159
|
+
{
|
160
|
+
|
161
|
+
//
|
162
|
+
|
163
|
+
}
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
/**
|
168
|
+
|
169
|
+
* Store a newly created resource in storage.
|
170
|
+
|
171
|
+
*
|
172
|
+
|
173
|
+
* @param \Illuminate\Http\Request $request
|
174
|
+
|
175
|
+
* @return \Illuminate\Http\Response
|
176
|
+
|
177
|
+
*/
|
178
|
+
|
179
|
+
public function store(Request $request)
|
180
|
+
|
181
|
+
{
|
182
|
+
|
183
|
+
//
|
184
|
+
|
185
|
+
}
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
/**
|
190
|
+
|
191
|
+
* Display the specified resource.
|
192
|
+
|
193
|
+
*
|
194
|
+
|
195
|
+
* @param int $id
|
196
|
+
|
197
|
+
* @return \Illuminate\Http\Response
|
198
|
+
|
199
|
+
*/
|
200
|
+
|
201
|
+
public function show($id)
|
202
|
+
|
203
|
+
{
|
204
|
+
|
205
|
+
$user = User::findOrFail($id);
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
$user->loadRelationshipCounts();
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
$reviews = $user->reviews()->orderBy('created_at', 'desc')->paginate(100);
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
return view('reviews.review', [
|
220
|
+
|
221
|
+
'users' => $user,
|
222
|
+
|
223
|
+
'reviews'=>$review
|
224
|
+
|
225
|
+
]);
|
226
|
+
|
227
|
+
}
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
/**
|
232
|
+
|
233
|
+
* Show the form for editing the specified resource.
|
234
|
+
|
235
|
+
*
|
236
|
+
|
237
|
+
* @param int $id
|
238
|
+
|
239
|
+
* @return \Illuminate\Http\Response
|
240
|
+
|
241
|
+
*/
|
242
|
+
|
243
|
+
public function edit($id)
|
244
|
+
|
245
|
+
{
|
246
|
+
|
247
|
+
//
|
248
|
+
|
249
|
+
}
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
/**
|
254
|
+
|
255
|
+
* Update the specified resource in storage.
|
256
|
+
|
257
|
+
*
|
258
|
+
|
259
|
+
* @param \Illuminate\Http\Request $request
|
260
|
+
|
261
|
+
* @param int $id
|
262
|
+
|
263
|
+
* @return \Illuminate\Http\Response
|
264
|
+
|
265
|
+
*/
|
266
|
+
|
267
|
+
public function update(Request $request, $id)
|
268
|
+
|
269
|
+
{
|
270
|
+
|
271
|
+
//
|
272
|
+
|
273
|
+
}
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
/**
|
278
|
+
|
279
|
+
* Remove the specified resource from storage.
|
280
|
+
|
281
|
+
*
|
282
|
+
|
283
|
+
* @param int $id
|
284
|
+
|
285
|
+
* @return \Illuminate\Http\Response
|
286
|
+
|
287
|
+
*/
|
288
|
+
|
289
|
+
public function destroy($id)
|
290
|
+
|
291
|
+
{
|
292
|
+
|
293
|
+
//
|
294
|
+
|
295
|
+
}
|
296
|
+
|
297
|
+
}
|
298
|
+
|
299
|
+
```
|
300
|
+
|
99
301
|
|
100
302
|
|
101
303
|
### 試したこと
|