$ exception-> guards()返回null

问题描述 投票:1回答:1

我正在尝试自定义]中未经身份验证的功能>

App \ Exceptions \ Handler.php

根据卫队重定向用户和管理员,但$ exception-> guards()返回null,这是什么问题?

protected function unauthenticated($request, AuthenticationException $exception)
{
    if($request->expectsJson())
        return response()->json(['message' => $exception->getMessage()], 401);

        dd($exception->guards());
    return redirect()->guest(route('login'));
}
    

我正在尝试在App \ Exceptions \ Handler.php中定制未经身份验证的功能,以根据防护将用户和管理员重定向,但是$ exception-> guards()返回null,这是什么问题? ...

php laravel laravel-5.5
1个回答
0
投票

使用Illuminate\Support\Arr;

© www.soinside.com 2019 - 2024. All rights reserved.