Skip to content

Instantly share code, notes, and snippets.

@AdriC1705
Created August 14, 2020 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdriC1705/fd70519e7dcda9e81db07411ddec5c47 to your computer and use it in GitHub Desktop.
Save AdriC1705/fd70519e7dcda9e81db07411ddec5c47 to your computer and use it in GitHub Desktop.
public function guardarRespuesta(Request $request)
{
$idUser = $request->idUser;
$idQuestion = $request->question;
$answer = $request->answer;
try{
$ca = New Canswers();
$ca->updateOrCreate(
['id_users'=>$idUser, 'id_questions'=>$idQuestion],
['status'=> 1, 'description'=>$answer]
);
return response()->json([
"Code" => "200",
"Message" => "Se actualizo la información",
]);
}
catch(\Exception $e)
{
Log::info("[ERROR - edit] " .$e->getMessage());
return response()->json(
[
"Code" => "400",
"Message" => "Error al editar la respuesta",
]
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment