When coding out your laravel-passport example for version 5.6 from the original article:
The PUT request submits correctly via Postman, however when sending the GET request for /api/products, the change has not resolved.
Also, checked database and change has not resolved. Here is the code for 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);
}
Please note that the GET /api/products and POST /api/products work just fine and new products can be successfully posted to the DB.
Please advise.