Skip to content

Commit

Permalink
Fixes soft delete check, fixes nested tree restoration
Browse files Browse the repository at this point in the history
  • Loading branch information
daftspunk committed Feb 10, 2025
1 parent 0431b2f commit 8d4d37a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Database/Traits/NestedTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
use October\Rain\Database\Collection;
use October\Rain\Database\TreeCollection;
use October\Rain\Database\Scopes\NestedTreeScope;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Exception;

/**
Expand Down Expand Up @@ -120,7 +119,10 @@ public function initializeNestedTree()
$this->deleteDescendants();
});

if (static::hasGlobalScope(SoftDeletingScope::class)) {
if (
static::hasGlobalScope(\October\Rain\Database\Scopes\SoftDeleteScope::class) ||
static::hasGlobalScope(\Illuminate\Database\Eloquent\SoftDeletingScope::class)
) {
$this->bindEvent('model.beforeRestore', function () {
$this->shiftSiblingsForRestore();
});
Expand Down

0 comments on commit 8d4d37a

Please sign in to comment.