Skip to content

Commit 2722a10

Browse files
committed
Fix child deletion in ModelTree trait
Replaces the shorthand each->delete() with an explicit closure to ensure each child model is properly deleted. This improves compatibility and clarity in the child deletion process.
1 parent 55eb557 commit 2722a10

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Concern/ModelTree.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ public static function bootModelTree()
4646
static::buildSortQuery()
4747
->where($model->determineParentColumnName(), $model->getKey())
4848
->get()
49-
->each
50-
->delete();
49+
->each(function ($child) {
50+
$child->delete();
51+
});
5152
});
5253
}
5354

0 commit comments

Comments
 (0)