Skip to content

Commit f31b581

Browse files
authored
添加用户绑定后的处理
1 parent 79f66af commit f31b581

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/Middleware/Jwt.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,27 @@ public function handle($request, \Closure $next, $store = null)
3434
if ($info = $user->get()) {
3535
// 路由注入
3636
$request->user = $info;
37-
37+
3838
// 绑定当前用户模型
3939
$model = $user->getClass();
4040
$this->app->bind($model, $info);
41+
42+
// 绑定用户后一些业务处理
43+
$this->bindUserAfter($request);
4144
}
4245
} else {
4346
throw new JWTException('登录校验已失效, 请重新登录', 401);
4447
}
45-
48+
4649
return $next($request);
4750
}
4851

4952
throw new JWTException('Token 验证不通过', 401);
5053
}
54+
55+
protected function bindUserAfter($request)
56+
{
57+
// 当前用户
58+
// $request->user
59+
}
5160
}

0 commit comments

Comments
 (0)