Explorar el Código

修复HasMany无法把字段保存为空问题

jqh hace 5 años
padre
commit
570456d565
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      src/Repositories/EloquentRepository.php

+ 1 - 1
src/Repositories/EloquentRepository.php

@@ -720,7 +720,7 @@ class EloquentRepository extends Repository implements TreeRepository
                 || $relation instanceof Relations\MorphOne
                 || $relation instanceof Relations\BelongsTo;
 
-            $prepared = $form->prepareUpdate([$name => $values], $oneToOneRelation);
+            $prepared = $oneToOneRelation ? $form->prepareUpdate([$name => $values]) : [$name => $values];
 
             if (empty($prepared)) {
                 continue;