質問編集履歴

2

AdminController.phpの追記

2021/11/25 05:04

投稿

yoshioka01
yoshioka01

スコア21

test CHANGED
File without changes
test CHANGED
@@ -252,6 +252,84 @@
252
252
 
253
253
 
254
254
 
255
+ AdminController.php
256
+
257
+ ```php
258
+
259
+ <?php
260
+
261
+
262
+
263
+ namespace App\Http\Controllers;
264
+
265
+
266
+
267
+ use Illuminate\Http\Request;
268
+
269
+
270
+
271
+ use \App\Memo;
272
+
273
+ use \App\User;
274
+
275
+
276
+
277
+
278
+
279
+ class HomeController extends Controller
280
+
281
+ {
282
+
283
+ /**
284
+
285
+ * Create a new controller instance.
286
+
287
+ *
288
+
289
+ * @return void
290
+
291
+ */
292
+
293
+ public function __construct()
294
+
295
+ {
296
+
297
+ $this->middleware('auth');
298
+
299
+ $this->middleware('auth:admin');
300
+
301
+
302
+
303
+ }
304
+
305
+
306
+
307
+ /**
308
+
309
+ * Show the application dashboard.
310
+
311
+ *
312
+
313
+ * @return \Illuminate\Contracts\Support\Renderable
314
+
315
+ */
316
+
317
+
318
+
319
+ public function create(){
320
+
321
+ return view('createadmin');
322
+
323
+ }
324
+
325
+
326
+
327
+ }
328
+
329
+ ```
330
+
331
+
332
+
255
333
  ### エラーの内容
256
334
 
257
335
  Target class [App\Http\Controllers\AdminController] does not exist.

1

エラーの内容を表示してなかった

2021/11/25 05:04

投稿

yoshioka01
yoshioka01

スコア21

test CHANGED
File without changes
test CHANGED
@@ -82,27 +82,31 @@
82
82
 
83
83
  Route::get('/register/admin', 'Auth\RegisterController@showAdminRegisterForm');
84
84
 
85
-
86
-
87
85
  Route::post('/login/admin', 'Auth\LoginController@adminLogin');
88
86
 
89
87
  Route::post('/register/admin', 'Auth\RegisterController@createAdmin');
90
88
 
91
89
 
92
90
 
93
- //Route::get('content/admin',この部分が???);
94
-
95
-
96
-
97
91
  Route::view('/home', 'home')->middleware('auth');
98
92
 
99
93
  Route::view('/admin', 'admin');
100
94
 
95
+
96
+
97
+ //
98
+
99
+ Route::get('/create/admin', 'AdminController@create')->name('create');
100
+
101
+
102
+
103
+
104
+
101
- ```
105
+ ```
102
-
103
-
104
-
106
+
107
+
108
+
105
- Viewの設定
109
+ Viewの設定 admin.blade.phpとcreate.blade.php
106
110
 
107
111
  ```admin.blade.php
108
112
 
@@ -142,6 +146,36 @@
142
146
 
143
147
  ```
144
148
 
149
+ ```createadmin.blade.php
150
+
151
+ @extends('layouts.auth')
152
+
153
+
154
+
155
+ @section('content')
156
+
157
+ <div class="container">
158
+
159
+ <div class="row justify-content-center">
160
+
161
+ <div class="col-md-8">
162
+
163
+ <div class="card">
164
+
165
+ <p>Hello Create!!</p>
166
+
167
+ </div>
168
+
169
+ </div>
170
+
171
+ </div>
172
+
173
+ </div>
174
+
175
+ @endsection
176
+
177
+ ```
178
+
145
179
 
146
180
 
147
181
 
@@ -215,3 +249,9 @@
215
249
  }
216
250
 
217
251
  ```
252
+
253
+
254
+
255
+ ### エラーの内容
256
+
257
+ Target class [App\Http\Controllers\AdminController] does not exist.