When i use update function in laravel with image using api then PUT method is not updated the validation, why? when i using the post method for update function postman and routes its work? its my route Route::post('/update-product/{id}', [ProductController::class, 'update']); and its my function public function update(Request $request, $id)
{
$product = Product::findOrFail($id);
$request->validate([
'name' => 'required|string|max:255',
'image' => 'image|mimes:jpeg,png,jpg,gif|max:2048',
'price' => 'required|numeric|min:0',
'quantity' => 'required|numeric|min:0',
'status' => 'boolean',
]);
$product->name = $request->input('name');
$product->price = $request->input('price');
$product->quantity = $request->input('quantity');
$product->status = $request->input('status');
$product->save();
if ($request->hasFile('image')) {
$imagePath = "storage/" . $request->file('image')->store("Product_image", "public");
$formData['image'] = $imagePath;
}
return response()->json(['message' => 'Product updated successfully', 'product' => $product], 200);
}