Skip to content

Commit af9469d

Browse files
committed
fix delete button
1 parent ef2adbb commit af9469d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/core/src/Entities/BaseResource.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,9 +535,13 @@ public static function getDeleteAction(): Action
535535
$translation = $livewire->record->translations()->withTrashed()->where('locale', $currentLang)->first();
536536

537537
if ($translation && $translation->trashed()) {
538-
$translation->forceDelete();
539-
540-
$livewire->record->checkAndDeleteIfAllTranslationsDeleted();
538+
$remainingTranslations = $livewire->record->translations()->withTrashed()->where('locale', '!=', $currentLang)->count();
539+
540+
if ($remainingTranslations === 0) {
541+
$livewire->record->forceDelete();
542+
} else {
543+
$translation->forceDelete();
544+
}
541545

542546
Notification::make()
543547
->title(__('core::core.record_permanently_deleted'))

0 commit comments

Comments
 (0)