public function mEditMascota($mascota) { try { if (is_array($mascota)) { $mascota = (object) $mascota; } //print_r($mascota);die; $mascotaData = $this->find($mascota->uuid); $mascotaData->UUID_mascota = $mascota->uuid; $mascotaData->nombre = strip_tags($mascota->nombre); $mascotaData->UUID_clase_mascota = strip_tags($mascota->clase_mascota); $mascotaData->UUID_raza = strip_tags($mascota->raza); $mascotaData->description = strip_tags($mascota->description); $mascotaData->edad = strip_tags($mascota->edad); $mascotaData->sexo = strip_tags($mascota->sexo); $mascotaData->datos_adicionales = strip_tags($mascota->datos); $mascotaData->caracter = $mascota->caracter; $mascotaData->tiene_vacunas = $mascota->tiene_vacunas; $mascotaData->vacunas_cuales = $mascota->vacunas_cuales; $mascotaData->peso = $mascota->peso; $mascotaData->tamano = $mascota->tamano; $mascotaData->padre = $mascota->padre; $mascotaData->certificado = $mascota->certificado; if ($mascotaData->save()) { return HTTPResponse::response(0, 201); } } catch (exception $e) { return HTTPResponse::response(1, 500); } }
public function post_register() { session_start(); $this->data = Input::all(); $emailExist = $this->connection->mVerifyEmail($this->data["email"]); try { if (!$emailExist) { $this->data["UUID"] = UUID::getUUID(); if ($this->connection->mSave($this->data)) { //logea al usuario despues de ser registrado $user = $this->connection->mUserByEmail($this->data["email"]); //print_r($user);die; //print_r($this->data);die; try { $client = new Client(); $r = $client->post('http://dev.petmatch.club/email.php', ["body" => $this->data]); $r->getBody(); } catch (exception $e) { echo $e; } //$email = new Email(); //$email->sendEmail($this->data["email"],$this->data["nombre"]); /*$credentials = array( "email" => $this->data["email"], "password" => $this->data["password"] ); if (Auth::attempt($credentials)) { $_SESSION["email"] = $this->data["email"]; }*/ return HTTPResponse::response(0, 201); } } else { return json_encode(array("error" => 1, "message" => $this->data["email"] . " ya existe", "status" => 200)); } } catch (exception $e) { echo HTTPResponse::response(1, 500); } }