diff --git a/README.md b/README.md
index e3bd6e6..94f531e 100644
--- a/README.md
+++ b/README.md
@@ -58,6 +58,7 @@ if you want to show for specific parameters to sort, icon, title, navigation gro
->setSort(10)
->canAccess(fn () => auth()->user()->id === 1)
->shouldRegisterNavigation(false)
+ ->shouldShowDeleteAccountForm(false)
])
```
diff --git a/resources/views/filament/pages/edit-profile-page.blade.php b/resources/views/filament/pages/edit-profile-page.blade.php
index 0b8f656..c2b8cd7 100644
--- a/resources/views/filament/pages/edit-profile-page.blade.php
+++ b/resources/views/filament/pages/edit-profile-page.blade.php
@@ -17,7 +17,9 @@
/>
-
- {{ $this->deleteAccountForm }}
-
+ @if($this->shouldShowDeleteAccountForm())
+
+ {{ $this->deleteAccountForm }}
+
+ @endif
diff --git a/src/FilamentEditProfilePlugin.php b/src/FilamentEditProfilePlugin.php
index 90cb54f..25b144d 100644
--- a/src/FilamentEditProfilePlugin.php
+++ b/src/FilamentEditProfilePlugin.php
@@ -26,6 +26,8 @@ class FilamentEditProfilePlugin implements Plugin
public Closure | string $navigationLabel = '';
+ public Closure | bool $shouldShowDeleteAccountForm = true;
+
public function getId(): string
{
return 'filament-edit-profile';
@@ -146,4 +148,16 @@ public function getShouldRegisterNavigation(): bool
{
return $this->evaluate($this->shouldRegisterNavigation);
}
+
+ public function shouldShowDeleteAccountForm(Closure | bool $value = true): static
+ {
+ $this->shouldShowDeleteAccountForm = $value;
+
+ return $this;
+ }
+
+ public function getShouldShowDeleteAccountForm(): bool
+ {
+ return $this->evaluate($this->shouldShowDeleteAccountForm);
+ }
}
diff --git a/src/Pages/EditProfilePage.php b/src/Pages/EditProfilePage.php
index 24fbacd..78a3a29 100644
--- a/src/Pages/EditProfilePage.php
+++ b/src/Pages/EditProfilePage.php
@@ -75,6 +75,13 @@ public static function canAccess(): bool
return $plugin->getCanAccess();
}
+ public static function shouldShowDeleteAccountForm()
+ {
+ $plugin = Filament::getCurrentPanel()?->getPlugin('filament-edit-profile');
+
+ return $plugin->getShouldShowDeleteAccountForm();
+ }
+
public ?array $profileData = [];
public ?array $passwordData = [];