File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff 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 );
You can’t perform that action at this time.
0 commit comments