Commit df41a31b by 杨树贤

登陆重定向设置

parent db51fb74
Showing with 8 additions and 0 deletions
......@@ -2,6 +2,7 @@
namespace App\Exceptions;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
......@@ -52,4 +53,11 @@ class Handler extends ExceptionHandler
{
return parent::render($request, $exception);
}
protected function unauthenticated($request, AuthenticationException $exception)
{
return $request->expectsJson()
? response()->json(['message' => $exception->getMessage()], 401)
: redirect()->guest(route('login')."?referer=".url()->current());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment