"message": "Argument 1 passed to Tymon\\JWTAuth\\JWTGuard::login () must be an instance of Tymon\\JWTAuth\\Contracts\\JWTSubject, instance of App\\User given, called in D:\\phpStudy\\PHPTutorial\\WWW\\financeApi\\vendor\\tymon\\jwt-auth\\src\\JWTGuard.php
"message": "Argument 1 passed to Tymon\JWTAuth\JWTGuard::login() must be an instance of Tymon\JWTAuth\Contracts\JWTSubject, instance of App\User given, called in D:\phpStudy\PHPTutorial\WWW\financeApi\vendor\tymon\jwt-auth\src\JWTGuard.php on line 127",
登录认证的时候为什么报这个错误。。。。
User模型的代码:
<?php
namespace App\Models;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Auth;
use Spatie\Permission\Traits\HasRoles;
class Users extends Authenticatable implements JWTSubject{
use Notifiable;
public function getJWTIdentifier()
{
return $this->getKey();
}
public function getJWTCustomClaims()
{
return [];
}
}
@liyu001989 好了,user模型找错了。。auth.php改成这样就好了
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],