1
I’m a beginner in PHP - Lumen and I’m doing my first api. All my methods in the controller are working, except the update. Even if it returns true, the data is not changed in the database.
public function update(Request $request, $id)
{
$agendamento = $this->model->find($id)
->update($request->all());
return response()->json($agendamento);
}
I already checked and $request is bringing the data correctly.
Is there a change to be made? How is your object before and after sending the request? How is the request data?
– Erlon Charles
1 - GET/2
{
 "Id": 2,
 "IdSala": 2,
 "EmailRequisitante": "[email protected]",
 "DataHoraInicio": "2019-12-06 15:00:00",
 "DataHoraFim": "2019-12-06 16:00:00",
 "Situacao": "Avitva",
 "Descricao": "Teste data e hora"
}
2 - PUT/2{
 "Id": 2, 
 "IdSala": 2,
 "EmailRequisitante": "[email protected]",
 "DataHoraInicio": "2019-12-06 15:00:00",
 "DataHoraFim": "2019-12-06 16:30:35",
 "Situacao": "Avitva",
 "Descricao": "Teste data e hora MODIFICADO"
}
After PUT, when making a new GET, the returned data remains as in the first situation.– Ana Carol
My mapping
$router->put("/{id}", "AgendamentoController@update");
– Ana Carol