← All changes
|
app/Modules/Shipping/Http/Controllers/ShippingZoneController.php
+6
-0
1.3.20
→
1.6.5
View file →
| @@ -48,9 +48,15 @@ | ||
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function update(ShippingZoneRequest $request, $id) |
| 51 | 51 | { |
| 52 | + // When the client omits shipping_class_id, ShippingZoneRequest:: | |
| 53 | + // beforeValidation resolves the zone's stored class into the request | |
| 54 | + // (its return is merged in), so validation checks the effective class | |
| 55 | + // and this write preserves it — getSafe would otherwise emit the | |
| 56 | + // mapped key as null and wipe the stored link. | |
| 52 | 57 | $data = $request->getSafe($request->sanitize()); |
| 58 | + | |
| 53 | 59 | $shippingZone = ShippingZone::query()->findOrFail($id); |
| 54 | 60 | if (Arr::get($data, 'region') !== $shippingZone->region) { |
| 55 | 61 | ShippingMethod::where('zone_id', $id)->update(['states' => []]); |
| 56 | 62 | } |