Hy guys, today i have this problem with my api. I don't update the record on DB. In postaman the response is true but don.t save in db. In Postaman i passed with PUT method and set in Body name a text
ProductController:
public function update(Request $request, $id)
{
$product = auth()->user()->products()->find($id);
if (!$product) {
return response()->json([
'success' => false,
'message' => 'Product with id ' . $id . ' not found'
], 400);
}
$updated = $product->fill($request->all())->save();
if ($updated)
return response()->json([
'success' => true
]);
else
return response()->json([
'success' => false,
'message' => 'Product could not be updated'
], 500);
}
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2Wlef7X
via IFTTT
Aucun commentaire:
Enregistrer un commentaire