質問するログイン新規登録

質問編集履歴

2

追記

2020/06/14 02:21

投稿

mmmmmr
mmmmmr

スコア18

title CHANGED
File without changes
body CHANGED
@@ -96,4 +96,31 @@
96
96
  </body>
97
97
 
98
98
  </html>
99
+ ```
100
+
101
+ ##追記
102
+ ご指摘いただいたのでエラーとコントローラーの処理を追記します。
103
+
104
+ 発生しているエラー
105
+ ```
106
+ syntax error, unexpected 'endforeach' (T_ENDFOREACH), expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF)(View: /work/resources/views/users/index.blade.php)
107
+ ```
108
+
109
+ ```controller
110
+ <?php
111
+
112
+ namespace App\Http\Controllers;
113
+
114
+ use Illuminate\Http\Request;
115
+ use App\Models\User:
116
+
117
+ class UserController extends Controller
118
+ {
119
+
120
+ public function index()
121
+ {
122
+ $users = User::get();
123
+ return view('users.index')->with('users', $users);
124
+ }
125
+ }
99
126
  ```

1

誤字

2020/06/14 02:21

投稿

mmmmmr
mmmmmr

スコア18

title CHANGED
File without changes
body CHANGED
@@ -16,7 +16,7 @@
16
16
  @section('title', 'user一覧ページ')
17
17
  @section('content')
18
18
 
19
- @foreach($characters as $chara)
19
+ @foreach($users as $user)
20
20
  ユーザー名:{{ $user->name }}
21
21
  @endforeach
22
22
 
@@ -96,8 +96,4 @@
96
96
  </body>
97
97
 
98
98
  </html>
99
- ```
99
+ ```
100
-
101
-
102
-
103
- ##使用環境