diff --git a/app/Filament/Resources/UserResource/Pages/EditUser.php b/app/Filament/Resources/UserResource/Pages/EditUser.php index ec6ff103f..e12e4de40 100644 --- a/app/Filament/Resources/UserResource/Pages/EditUser.php +++ b/app/Filament/Resources/UserResource/Pages/EditUser.php @@ -67,8 +67,8 @@ class EditUser extends EditRecord { return [ Actions\DeleteAction::make() - ->label(fn (User $user) => auth()->user()->id === $user->id ? 'Can\'t Delete Yourself' : 'Delete') - ->disabled(fn (User $user) => auth()->user()->id === $user->id), + ->label(fn (User $user) => auth()->user()->id === $user->id ? 'Can\'t Delete Yourself' : ($user->servers()->count() > 0 ? 'User Has Servers' : 'Delete')) + ->disabled(fn (User $user) => auth()->user()->id === $user->id || $user->servers()->count() > 0), $this->getSaveFormAction()->formId('form'), ]; }