撤销过期的access_token遇到如下问题,怎么回事呢?Laravel5.4 Passport


注册事件/监听器:
protected $listen = [
'Laravel\Passport\Events\AccessTokenCreated' => [
'App\Listeners\RevokeOldTokens',
],
'Laravel\Passport\Events\RefreshTokenCreated' => [
'App\Listeners\PruneOldTokens',
],
];

监听器handle方法:
public function handle(AccessTokenCreated $event)
{
Token::where('id', '!=', $event->tokenId)
->where('user_id', $event->userId)
->where('client_id', $event->clientId)
->where('expires_at', '<', Carbon::now())
->orWhere('revoked', true)
->delete();
}

报错:
Argument 1 passed to App\Listeners\RevokeOldTokens::handle() must be an instance of App\Events\Laravel\Passport\Events\AccessTokenCreated, instance of Laravel\Passport\Events\AccessTokenCreated given

请教各位指点了。


Vote Vote Cancel Collect Collect Cancel

<< 上一篇: 关于路由层

>> 下一篇: 新萌问一下图片处理类的问题