Skip to content

Commit 67a1055

Browse files
committed
Fixed
1 parent b2f6af8 commit 67a1055

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/QueryBuilder.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -941,12 +941,12 @@ public function rebuildTree(array $data, $delete = false)
941941
foreach ($existing as $model) {
942942
$dictionary[$model->getParentId()][] = $model;
943943

944-
if ($this->model->usesSoftDelete()) {
945-
if ( ! $model->{$model->getDeletedAtColumn()}) {
946-
$time = $this->model->fromDateTime($this->model->freshTimestamp());
944+
if ($delete && $this->model->usesSoftDelete() &&
945+
! $model->{$model->getDeletedAtColumn()}
946+
) {
947+
$time = $this->model->fromDateTime($this->model->freshTimestamp());
947948

948-
$model->{$model->getDeletedAtColumn()} = $time;
949-
}
949+
$model->{$model->getDeletedAtColumn()} = $time;
950950
}
951951
}
952952
}
@@ -970,7 +970,7 @@ protected function buildRebuildDictionary(array &$dictionary,
970970

971971
foreach ($data as $itemData) {
972972
if ( ! isset($itemData[$keyName])) {
973-
$model = $this->model->newInstance();
973+
$model = $this->model->newInstance($this->model->getAttributes());
974974

975975
// We will save it as raw node since tree will be fixed
976976
$model->rawNode(0, 0, $parentId);

0 commit comments

Comments
 (0)