Skip to content

Commit 98806a0

Browse files
committed
trigger the delete events for each of related deleted model
1 parent bea3042 commit 98806a0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/app/Library/CrudPanel/Traits/Create.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ private function handleManyRelationItemRemoval($modelInstance, $removedEntries,
264264
// developer set force_delete => true, so we don't care if it's nullable or not,
265265
// we just follow developer's will
266266
if ($forceDelete) {
267-
return $removedEntries->delete();
267+
return $removedEntries->lazy()->each->delete();
268268
}
269269

270270
// get the default that could be set at database level.
@@ -273,7 +273,7 @@ private function handleManyRelationItemRemoval($modelInstance, $removedEntries,
273273
// if column is not nullable in database, and there is no column default (null),
274274
// we will delete the entry from the database, otherwise it will throw and ugly DB error.
275275
if (! $relationColumnIsNullable && $dbColumnDefault === null) {
276-
return $removedEntries->delete();
276+
return $removedEntries->lazy()->each->delete();
277277
}
278278

279279
// if column is nullable we just set it to the column default (null when it does exist, or the default value when it does).

0 commit comments

Comments
 (0)