diff --git a/app/Services/ParkingElectronicMapService.php b/app/Services/ParkingElectronicMapService.php index d44c069..7c840f2 100644 --- a/app/Services/ParkingElectronicMapService.php +++ b/app/Services/ParkingElectronicMapService.php @@ -29,7 +29,7 @@ class ParkingElectronicMapService extends BaseService 'floor_id' => $floor_id, 'space_id' => $space_id ]; - $res = ParkingElectronicMap::query()->where($where)->get()->toArray(); + $res = ParkingElectronicMap::query()->where($where)->first(); $saveData['width'] = $data['width'] ?? '0'; $saveData['height'] = $data['height'] ?? '0'; $saveData['coordinate_x'] = $data['coordinate_x'] ?? ''; @@ -40,7 +40,7 @@ class ParkingElectronicMapService extends BaseService $saveData['aspect_ratio'] = $data['aspect_ratio'] ?? ''; if ($res) { $saveData['update_at'] = get_datetime(); - $model = ParkingElectronicMap::query()->findOrFail($res[0]['id']); + $model = ParkingElectronicMap::query()->findOrFail($res['id']); $oldValues = $model->toArray(); $model->update($saveData); $this->logService->logUpdated($model, $oldValues, 'map.save');