Conditions | 2 |
Paths | 2 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
20 | protected function createJwtUser() |
||
21 | { |
||
22 | if(empty($this->model->password)) { |
||
23 | Json::outputErrors( |
||
24 | [ |
||
25 | [ |
||
26 | JSONApiInterface::ERROR_TITLE => 'Password should be provided', |
||
27 | JSONApiInterface::ERROR_DETAIL => 'To get refreshed token in future usage of application - user password should be provided', |
||
28 | ], |
||
29 | ] |
||
30 | ); |
||
31 | } |
||
32 | |||
33 | /** @var \Illuminate\Database\Eloquent\Model $model */ |
||
34 | $model = $this->getEntity($this->model->id); |
||
35 | $model->jwt = Jwt::create($this->model->id); |
||
36 | $model->password = password_hash($this->model->password, PASSWORD_DEFAULT); |
||
37 | $model->save(); |
||
38 | $this->model = $model; |
||
39 | unset($this->model->password); |
||
40 | } |
||
62 | } |