How can admin and user be redirected in laravel 5.6.12? I cannot find unauthenticated function in app/Exceptions/Handler.php file..
1条回答 默认 最新
- duan7664 2018-03-26 13:05关注
The
unauthenticated
method exists in the parent handler,Illuminate\Foundation\Exceptions\Handler
. Just override it, like so;protected function unauthenticated($request, AuthenticationException $exception) { if ($request->expectsJson()) { return response()->json(['message' => $exception->getMessage()], 401); } $guard = $exception->guards()[0]; return redirect(route($guard . ':auth.create')); }
解决 无用评论 打赏 举报