Esempio n. 1
0
 public function changeEmail(UserService $user, $user_id)
 {
     try {
         $input = Request::only('email');
         $validation = $user->validateUserEmail($input, $user_id);
         if (!$validation->fails()) {
             $response = $user->updateUserEmail($user_id, $input['email']);
             if (!empty($response)) {
                 return $this->json_response->success($response);
             }
             return $this->json_response->error($response, 'Success updating email!');
         } else {
             return $this->json_response->error(['validation_message' => $validation->messages()]);
         }
     } catch (Exception $e) {
         return $this->json_response->error(['error' => $e->getMessage()]);
     }
 }