-1
I’m having a problem with a route of my system.
Route::get('/atualizacoes/list', 'AtualizacoesController@listarIndex')->name('atualizacoes.listar');
From what I understand he is interpreting the "list" in "/updates/list" as if it were a value. Does anyone have any idea how to solve?
Error:
invalid input syntax for integer: "list " (SQL: select * from "ger_update " Where "att_code " = list limit 1)"
Controller Code:
public function show($id){
$atualizacao = GerAtualizacao::where('att_codigo', $id)->first();
return response()->json($atualizacao);
}
public function listarIndex(){
$atualizacoes = GerAtualizacao::all();
return response()->json($atualizacoes);
}
It was supposed to enter the function "list" but it enters the function "show"
Face this is database problem... not the route itself, detail more your problem, post the controller code and if possible the description of the tables involved in the controller.
– Tadeu Mansi
I edited the question with the controller code
– João.Mistura
By chance some of your routes have the same name or the same url?
– JrD
I’m using apiResource on the routes, except for this route I put in the question
– João.Mistura
put the following command somewhere and show us the result:
foreach (Route::getRoutes() as $route) {
 var_dump($route->getUri());
}
– Alvaro Alves
You probably set before these routes a
Route::resource
. In Laravel, if using Resource with other routes, always set the routes before declaring theresource
.– Wallace Maxters
@Wallacemaxters Valeu, that was the problem, but now the "store" function of Resource stopped working
– João.Mistura
@João.Mistura I left answered your question, to help other users. Consider marking the answer as accepted, if you think you should do this.
– Wallace Maxters