ldc-gen-game-web/app/Exceptions/Handler.php

48 lines
1 KiB
PHP
Raw Permalink Normal View History

2020-10-21 15:26:21 +02:00
<?php
namespace App\Exceptions;
2022-03-15 16:27:41 +01:00
use Illuminate\Session\TokenMismatchException;
use Kwaadpepper\ExceptionHandler\Exceptions\ExceptionHandler;
2022-03-15 16:27:41 +01:00
use Throwable;
2020-10-21 15:26:21 +02:00
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
RedirectTo::class
2020-10-21 15:26:21 +02:00
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
2022-03-15 16:27:41 +01:00
/**
* Report or log an exception.
*
* @param \Throwable $e
* @return void
*
* @throws \Exception .
*/
public function report(Throwable $e)
{
if (\get_class($e) === TokenMismatchException::class) {
abort(\request()->routeIs('bo.*') ?
response()->redirectToRoute('bo.dashboard') :
response()->redirectToRoute('home'));
}
parent::report($e);
}
2020-10-21 15:26:21 +02:00
}