| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function handle($request, \Closure $next) |
||
| 26 | { |
||
| 27 | if (true === $this->app->jwt->verify()) { |
||
| 28 | // 自动注入用户模型 |
||
| 29 | if ($this->user->hasInject()) { |
||
| 30 | $user = $this->user->get(); |
||
| 31 | // 路由注入 |
||
| 32 | $request->user = $user; |
||
| 33 | |||
| 34 | // 绑定当前用户模型 |
||
| 35 | $model = $this->user->getModel(); |
||
| 36 | $this->app->bind($model, $user); |
||
| 37 | } |
||
| 38 | |||
| 39 | return $next($request); |
||
| 40 | } |
||
| 41 | |||
| 42 | throw new JWTException('Token 验证不通过', 401); |
||
| 43 | } |
||
| 45 |