質問編集履歴

5

追記

2019/08/17 17:26

投稿

hasshy
hasshy

スコア102

test CHANGED
File without changes
test CHANGED
@@ -222,7 +222,7 @@
222
222
 
223
223
  問題が発生した時に起因した箇所は下記でした。
224
224
 
225
- 原因確認中
225
+ エラーページを共通化しようとした時に修正したときのものした
226
226
 
227
227
 
228
228
 

4

調査内容追加

2019/08/17 17:26

投稿

hasshy
hasshy

スコア102

test CHANGED
File without changes
test CHANGED
@@ -216,6 +216,190 @@
216
216
 
217
217
 
218
218
 
219
+ ### Exceptions/Handler.php
220
+
221
+
222
+
223
+ 問題が発生した時に起因した箇所は下記でした。
224
+
225
+ 原因確認中です。
226
+
227
+
228
+
229
+ (プロジェクトディレクトリ)/app/Exceptions/Handler.php
230
+
231
+
232
+
233
+ ```php
234
+
235
+ <?php
236
+
237
+
238
+
239
+ namespace App\Exceptions;
240
+
241
+
242
+
243
+ use Exception;
244
+
245
+ use Illuminate\Auth\AuthenticationException;
246
+
247
+ use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
248
+
249
+ use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
250
+
251
+
252
+
253
+ class Handler extends ExceptionHandler
254
+
255
+ {
256
+
257
+ private $routeBase;
258
+
259
+
260
+
261
+ /**
262
+
263
+ * A list of the exception types that are not reported.
264
+
265
+ *
266
+
267
+ * @var array
268
+
269
+ */
270
+
271
+ protected $dontReport = [
272
+
273
+ //
274
+
275
+ ];
276
+
277
+
278
+
279
+ /**
280
+
281
+ * A list of the inputs that are never flashed for validation exceptions.
282
+
283
+ *
284
+
285
+ * @var array
286
+
287
+ */
288
+
289
+ protected $dontFlash = [
290
+
291
+ 'password',
292
+
293
+ 'password_confirmation',
294
+
295
+ ];
296
+
297
+
298
+
299
+ /**
300
+
301
+ * Report or log an exception.
302
+
303
+ *
304
+
305
+ * @param \Exception $exception
306
+
307
+ * @return void
308
+
309
+ */
310
+
311
+ public function report(Exception $exception)
312
+
313
+ {
314
+
315
+ parent::report($exception);
316
+
317
+ }
318
+
319
+
320
+
321
+ /**
322
+
323
+ * Render an exception into an HTTP response.
324
+
325
+ *
326
+
327
+ * @param \Illuminate\Http\Request $request
328
+
329
+ * @param \Exception $exception
330
+
331
+ * @return \Illuminate\Http\Response
332
+
333
+ */
334
+
335
+ public function render($request, Exception $exception)
336
+
337
+ {
338
+
339
+ // ルート確認
340
+
341
+ $route = app('router')
342
+
343
+ ->getRoutes()
344
+
345
+ ->match(app('request')
346
+
347
+ ->create($request->getRequestUri()))
348
+
349
+ ->getName();
350
+
351
+ $route = explode('.', $route);
352
+
353
+ $this->routeBase = count($route) > 0
354
+
355
+ ? $route[0]
356
+
357
+ : null;
358
+
359
+ return parent::render($request, $exception);
360
+
361
+ }
362
+
363
+
364
+
365
+ protected function renderHttpException(HttpExceptionInterface $e) {
366
+
367
+ $statusCode = $e->getStatusCode();
368
+
369
+ $message = $e->getMessage();
370
+
371
+
372
+
373
+ $redirectURL = $this->routeBase
374
+
375
+ ? route(\Config("route.auth_home.{$this->routeBase}"))
376
+
377
+ : null;
378
+
379
+
380
+
381
+ return response()->view('errors.common',
382
+
383
+ compact('statusCode', 'message', 'redirectURL'),
384
+
385
+ $statusCode
386
+
387
+ );
388
+
389
+ }
390
+
391
+
392
+
393
+
394
+
395
+ }
396
+
397
+
398
+
399
+ ```
400
+
401
+
402
+
219
403
  ## エラーログの内容
220
404
 
221
405
 

3

追記

2019/08/17 17:24

投稿

hasshy
hasshy

スコア102

test CHANGED
File without changes
test CHANGED
@@ -292,6 +292,8 @@
292
292
 
293
293
  同じURLを指定してみたところ正常にPOSTされました。
294
294
 
295
+ これで解決はできるのですが、デフォルトの設定で動作しないので、根本的な原因を探っています。
296
+
295
297
 
296
298
 
297
299
  ```

2

誤字修正

2019/08/17 15:28

投稿

hasshy
hasshy

スコア102

test CHANGED
File without changes
test CHANGED
@@ -2,9 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- [【Laravel】FormでPostしてもPostとして送信できない
6
-
7
- ](https://teratail.com/questions/205875)
5
+ [【Laravel】FormでPostしてもPostとして送信できない](https://teratail.com/questions/205875)
8
6
 
9
7
 
10
8
 

1

誤字修正

2019/08/17 15:26

投稿

hasshy
hasshy

スコア102

test CHANGED
File without changes
test CHANGED
@@ -44,7 +44,7 @@
44
44
 
45
45
  ```php
46
46
 
47
- // スクール管理画面
47
+ // 管理画面
48
48
 
49
49
  Route::group([
50
50