I'm using Laravel 8, in production my .env
set to APP_DEBUG=false
but I don't want show a 500 view, I need redirect to mysite.com/home if Laravel returns a 500 error.
In Laravel docs (https://laravel.com/docs/8.x/errors) explain how to handle errors but i can't understand it, im new in Laravel 8.
My app/Exceptions/Handler.php is:
<?php
namespace AppExceptions;
use IlluminateFoundationExceptionsHandler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->reportable(function (Throwable $e) {
//
});
}
}
question from:
https://stackoverflow.com/questions/65948674/in-laravel-8-how-to-redirect-to-home-in-case-on-500-error 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…