App\Repositories\Frontend\Access\User\UserRepository::changePassword PHP Method

changePassword() public method

public changePassword ( $input ) : mixed
$input
return mixed
    public function changePassword($input)
    {
        $user = parent::find(access()->id());
        if (Hash::check($input['old_password'], $user->password)) {
            $user->password = bcrypt($input['password']);
            return parent::save($user);
        }
        throw new GeneralException(trans('exceptions.frontend.auth.password.change_mismatch'));
    }

Usage Example

 /**
  * @param ChangePasswordRequest $request
  * @return mixed
  */
 public function changePassword(ChangePasswordRequest $request)
 {
     $this->user->changePassword($request->all());
     return redirect()->route('frontend.user.account')->withFlashSuccess(trans('strings.frontend.user.password_updated'));
 }