Я не обновляю запись в базе данных.
В Postman ответ верен, но не сохраняется в базе данных.
В Postman Я передал метод PUT и установил в поле «Имя тела» текст.
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);
}

Подробнее здесь: https://stackoverflow.com/questions/563 ... h-passport
Мобильная версия