| Conditions | 3 |
| Paths | 1 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public function update($user, array $input) |
||
| 21 | { |
||
| 22 | Validator::make($input, [ |
||
| 23 | 'current_password' => ['required', 'string'], |
||
| 24 | 'password' => $this->passwordRules(), |
||
| 25 | ])->after(function ($validator) use ($user, $input) { |
||
| 26 | if (! isset($input['current_password']) || ! Hash::check($input['current_password'], $user->password)) { |
||
| 27 | $validator->errors()->add('current_password', __('The provided password does not match your current password.')); |
||
| 28 | } |
||
| 29 | })->validateWithBag('password'); |
||
| 30 | |||
| 31 | $user->forceFill([ |
||
| 32 | 'password' => Hash::make($input['password']), |
||
| 33 | ])->save(); |
||
| 34 | } |
||
| 36 |