change from
$product->update($request->all());
foreach ($request->img as $image){
$name = time().'_'.$image->getClientOriginalName();
$path = $image->storeAs('products', $name);
$photo = new Image();
$photo->name = $name;
$photo->link = $path;
$photo->product_id = $product->id;
$photo->save();
}`
to
$product->update($request->only(['name', 'description', 'width', 'weight', 'height', 'length', 'stock', 'price']));
if ($request->img) {
foreach ($request->img as $image){
$name = time().'_'.$image->getClientOriginalName();
$path = $image->storeAs('products', $name);
$photo = new Image();
$photo->name = $name;
$photo->link = $path;
$photo->product_id = $product->id;
$photo->save();
}
}