diff --git a/app/adminapi/controller/contract/VehicleContractController.php b/app/adminapi/controller/contract/VehicleContractController.php index d27adea99..23160b405 100644 --- a/app/adminapi/controller/contract/VehicleContractController.php +++ b/app/adminapi/controller/contract/VehicleContractController.php @@ -279,13 +279,14 @@ class VehicleContractController extends BaseAdminController if($data['type'] == 1){ if(empty($v['id'])){ $cars[$k]['type'] = 1; + }else{ + $rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty(); + if($rentInfo->isEmpty()){ + $cars[$k]['type'] = 0; + }else{ + $cars[$k]['type'] = $rentInfo['type']; + } } - $rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty(); - if($rentInfo->isEmpty()){ - $cars[$k]['type'] = 0; - }else{ - $cars[$k]['type'] = $rentInfo['type']; - } } if($data['type'] == 2){ $rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty();