From 94d0e150807270d6f752c23bdaaa40a58a91df1c Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Tue, 20 Jun 2017 11:49:44 -0500 Subject: [PATCH] redirect to login page on 403 --- app/Exceptions/Handler.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 21c9784c..20c80561 100755 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -44,6 +44,11 @@ class Handler extends ExceptionHandler */ public function render($request, Exception $exception) { + if ($exception instanceof \Symfony\Component\HttpKernel\Exception\HttpException + && $exception->getStatusCode() == 403) { + return redirect()->guest('login'); + } + return parent::render($request, $exception); }