From fd7afd2ead3f65cb62439cf6025f613c7b9b711e Mon Sep 17 00:00:00 2001 From: printempw Date: Wed, 28 Sep 2016 17:54:00 +0800 Subject: [PATCH] fix i18n when http exception occurs --- app/Exceptions/Handler.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 215d23b7..13d3e65f 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -3,6 +3,7 @@ namespace App\Exceptions; use Exception; +use App\Http\Middleware\Internationalization; use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Foundation\Validation\ValidationException; use Symfony\Component\HttpKernel\Exception\HttpException; @@ -55,6 +56,11 @@ class Handler extends ExceptionHandler exit; } + if ($e instanceof HttpException) { + // call i18n middleware manually since http exceptions won't be sent through it + (new Internationalization)->handle($request, function(){}); + } + if ($e instanceof ValidationException) { return $e->getResponse()->setStatusCode(200); }