#93 - fix if statement
This commit is contained in:
parent
0a664cf55d
commit
c0d9264296
@ -6,6 +6,7 @@ namespace Toby\Architecture;
|
|||||||
|
|
||||||
use Illuminate\Foundation\Exceptions\Handler;
|
use Illuminate\Foundation\Exceptions\Handler;
|
||||||
use Inertia\Inertia;
|
use Inertia\Inertia;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
class ExceptionHandler extends Handler
|
class ExceptionHandler extends Handler
|
||||||
@ -16,17 +17,21 @@ class ExceptionHandler extends Handler
|
|||||||
"password_confirmation",
|
"password_confirmation",
|
||||||
];
|
];
|
||||||
|
|
||||||
public function render($request, Throwable $e)
|
public function render($request, Throwable $e): Response
|
||||||
{
|
{
|
||||||
$response = parent::render($request, $e);
|
$response = parent::render($request, $e);
|
||||||
|
|
||||||
if (!app()->environment(['local', 'testing']) && in_array($response->status(), [500, 503, 404, 403])) {
|
if (!app()->environment(["local", "testing"]) && in_array($response->status(), [500, 503, 404, 403], true)) {
|
||||||
return Inertia::render('Error', ['status' => $response->status()])
|
return Inertia::render("Error", [
|
||||||
|
"status" => $response->status(),
|
||||||
|
])
|
||||||
->toResponse($request)
|
->toResponse($request)
|
||||||
->setStatusCode($response->status());
|
->setStatusCode($response->status());
|
||||||
} else if ($response->status() === 419) {
|
}
|
||||||
|
|
||||||
|
if ($response->status() === 419) {
|
||||||
return back()->with([
|
return back()->with([
|
||||||
'message' => 'The page expired, please try again.',
|
"message" => "The page expired, please try again.",
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user