我正在使用Laravel 5.5,并试图为用户和管理员实现多重身份验证.当我试图在浏览器中调用管理员登录表单时,我遇到了这个错误.
错误:
App\Exceptions\Handler::unauthenticated($request,App\Exceptions\AuthenticationException$exception)的声明应与illumb\Foundation\Exceptions\Handler::unauthenticated($request,illumb\Auth\AuthenticationException$exception)兼容
以下是我在app/Exceptions/Handler
中未经验证的函数:
protected function unauthenticated($request, AuthenticationException $exception)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}
$guard = array_get($exception->guards(), 0);
switch ($guard) {
case 'admin':
$login = 'admin.login';
break;
default:
$login = 'login';
break;
}
return redirect()->guest(route($login));
}
请帮我解决这个问题.