我使用Laravel 6.7 和 Passport来使用我自己的 API。当我尝试使用 注销用户时Auth::logout(),出现以下错误:
Illuminate\Auth\RequestGuard::logout 不存在。
我不明白为什么我会有这样的行为。我没有使用任何定制的守卫。根据 Passport 设置,我的Auth.php如下:
<?php
return [
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
],
Run Code Online (Sandbox Code Playgroud)
这是我的 AuthenticationController.php 注销代码所在的位置:
/**
* --------------------------------------------------
* Removes the identity of a users login session.
* --------------------------------------------------
* @param Request $request
* @return MessageResource
* -------------------------------------------------- …Run Code Online (Sandbox Code Playgroud)