I want to delete by id and the backend statements in slim v3, I do not know how it is done ... I have the following sentences for example a get that I do I do it in the following way:
Thanks in advance!
$app->get('/obtenerUsuarios', function (Request $request, Response $response, $args) {
// Para devolverlos todos los usuarios
$Usuarios = Usuarios::get();
// mas recomendado usar esta forma
return sendOkResponse($Usuarios ->toJson(),$response);
});
// Imprimir en formato JSON
function sendOkResponse($message,$response){
$newResponse = $response->withStatus(200)->withHeader('Content-Type','application/json');
$newResponse ->getBody()->write($message);
return $newResponse;
}
This is how I have to eliminate by the id of the user but I do not know what statements you have to put in without using bd, the pdo or those things that I do not know if the truth can be ...
$app->delete('/borrarUsuario/{id}', function ($request, $response, $args) {
// Delete book identified by $args['id']
});