diff --git a/app/Services/ParkingCameraService.php b/app/Services/ParkingCameraService.php index e923a88..f53981a 100644 --- a/app/Services/ParkingCameraService.php +++ b/app/Services/ParkingCameraService.php @@ -119,15 +119,17 @@ class ParkingCameraService extends BaseService foreach ($data as &$item) { $control_lights_ip = $item['control_lights_ip'] ?? ''; $space_attr_id = $item['space_attr_id'] ?? ''; - if (empty($control_lights_ip)) { - throw new CustomException( - __('validation.parking_camera.lights_ip_empty') - ); - } - if (strlen($control_lights_ip) > 15) { - throw new CustomException( - __('validation.parking_camera.lights_ip_max') - ); + if ($data['is_control_lights'] == 1) { + if (empty($control_lights_ip)) { + throw new CustomException( + __('validation.parking_camera.lights_ip_empty') + ); + } + if (strlen($control_lights_ip) > 15) { + throw new CustomException( + __('validation.parking_camera.lights_ip_max') + ); + } } $space_id = ParkingSpace::getValueId($item['space_number']); if (!$space_id && $space_attr_id) {