Exemplo n.º 1
0
 public function changePassword(UserService $user, $user_id)
 {
     try {
         $input = Request::only('password', 'password_confirmation');
         $validation = $user->validateUserPassword($input);
         if (!$validation->fails()) {
             $response = $user->updateUserPassword($user_id, $input['password']);
             if (!empty($response)) {
                 return $this->json_response->success($response, 'Success updating password!');
             }
             return $this->json_response->error($response);
         } else {
             return $this->json_response->error(['validation_message' => $validation->messages()]);
         }
     } catch (Exception $e) {
         return $this->json_response->error(['error' => $e->getMessage()]);
     }
 }