2020-10-21 15:26:21 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Exceptions;
|
|
|
|
|
|
2022-03-15 16:27:41 +01:00
|
|
|
use Illuminate\Session\TokenMismatchException;
|
2022-01-10 13:50:53 +01:00
|
|
|
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 = [
|
2022-01-10 13:50:53 +01:00
|
|
|
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
|
|
|
}
|