how to update a field in laravel 5.6

0

I'm trying to update a field in a table in laravel 5.6 but instead of updating it just adds a new one also happens to me that when I search the register through the show method it does not return anything. the stories table is a new table I just created it and its controller is the only one that is giving me problems.

public function update(Request $request, storie $storie)
    {
        $storie->fill($request->only([
            'descripcion_history'=>'string|max:200',
        ]));
        if($storie->isClean()){

            return $this->errorResponse('Debe enviar al menos  un dato para cambiar',409);
        }
        $storie->save();
        return response()->json(['mensaje'=>'se actualizo correctamente','codigo'=>'202'],202);
    }  
    
asked by Frank Campos Vilchez 25.09.2018 в 18:48
source

1 answer

0

Try this:

$storie->where('Id',$request['tu_input_id'])
       ->update(['descripcion_history'=>$request['tu_input_descripcion']]);

Greetings!

    
answered by 25.09.2018 в 19:06