Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
56 | public function get(): Model |
||
57 | { |
||
58 | $token = $this->app->jwt->getToken(); |
||
59 | |||
60 | if (!$token) { |
||
61 | throw new JWTException('未登录.', 500); |
||
62 | } |
||
63 | |||
64 | if (!$this->hasInject()) { |
||
65 | throw new JWTException('未开启注入功能.', 500); |
||
66 | } |
||
67 | |||
68 | $uid = $token->getClaim($this->app->jwt->getUniqidKey()); |
||
69 | |||
70 | $namespace = $this->getModel(); |
||
71 | $model = new $namespace(); |
||
72 | $user = $model->findOrFail($uid); |
||
73 | |||
74 | return $user; |
||
75 | } |
||
77 |