質問編集履歴

1

コードを追加

2020/12/04 07:05

投稿

user341
user341

スコア10

test CHANGED
File without changes
test CHANGED
@@ -6,19 +6,27 @@
6
6
 
7
7
  ```php
8
8
 
9
- public function user(Request $request)
9
+ public function index(Request $request)
10
10
 
11
11
  {
12
12
 
13
13
  $user_id = $request->query('user_id');
14
14
 
15
-
15
+ if( !ctype_digit($user_id) ){
16
16
 
17
- if( !ctype_digit($user_id)) {
17
+ return redirect('/');
18
-
19
-
20
18
 
21
19
  }
20
+
21
+
22
+
23
+ if( !User::find($user_id) ){
24
+
25
+ return redirect();
26
+
27
+ }
28
+
29
+ return view('user.index',['user_id' => $user_id);
22
30
 
23
31
  }
24
32