From 6769e60181f3c2f23f0cf8305e330824e0a43b88 Mon Sep 17 00:00:00 2001 From: Herbert Maschke Date: Fri, 16 Jan 2026 16:45:33 +0100 Subject: [PATCH 1/3] Make the enabled() function required the default behavior of enabling the plugin everywhere is dangerous, one may accidentally push the code to production. --- README.md | 4 ++-- src/FilamentDeveloperLoginsPlugin.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ab2c720..c272618 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ In the `users` method you can define the users (note: the users must exist), the // ... ->plugins([ FilamentDeveloperLoginsPlugin::make() - ->enabled() + ->enabled(app()->environment('local')) ->users([ 'Admin' => 'admin@example.com', 'User' => 'user@example.com', @@ -65,7 +65,7 @@ Example: ```php // ... FilamentDeveloperLoginsPlugin::make() - ->enabled(app()->environment('local')) + ->enabled(fn() => app()->environment('local')) ``` ### switchable() diff --git a/src/FilamentDeveloperLoginsPlugin.php b/src/FilamentDeveloperLoginsPlugin.php index 272c760..4d515a7 100644 --- a/src/FilamentDeveloperLoginsPlugin.php +++ b/src/FilamentDeveloperLoginsPlugin.php @@ -84,7 +84,7 @@ public static function getById(string $panelId): static throw new ImplementationException('No panel found with filament-developer-logins plugin.'); } - public function enabled(Closure | bool $value = true): static + public function enabled(Closure | bool $value): static { $this->enabled = $value; From 4e45b91c2c5be6dfcb1be81bd6aa1505ae1b2203 Mon Sep 17 00:00:00 2001 From: Bram Date: Tue, 20 Jan 2026 15:57:05 +0100 Subject: [PATCH 2/3] Set default to false --- src/FilamentDeveloperLoginsPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FilamentDeveloperLoginsPlugin.php b/src/FilamentDeveloperLoginsPlugin.php index 4d515a7..d394897 100644 --- a/src/FilamentDeveloperLoginsPlugin.php +++ b/src/FilamentDeveloperLoginsPlugin.php @@ -84,7 +84,7 @@ public static function getById(string $panelId): static throw new ImplementationException('No panel found with filament-developer-logins plugin.'); } - public function enabled(Closure | bool $value): static + public function enabled(Closure | bool $value = false): static { $this->enabled = $value; From 1e2ab92f7643a423524b6c27ab1c4c6bc364451a Mon Sep 17 00:00:00 2001 From: Bram Date: Tue, 20 Jan 2026 15:57:11 +0100 Subject: [PATCH 3/3] Update tests --- tests/Feature/DeveloperLoginsControllerTest.php | 2 +- tests/TestCase.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Feature/DeveloperLoginsControllerTest.php b/tests/Feature/DeveloperLoginsControllerTest.php index 3a00310..99bda55 100644 --- a/tests/Feature/DeveloperLoginsControllerTest.php +++ b/tests/Feature/DeveloperLoginsControllerTest.php @@ -52,7 +52,7 @@ public function test_an_exception_is_thrown_when_the_email_is_not_registered(): public function test_403_is_returned_when_plugin_is_disabled(): void { FilamentDeveloperLoginsPlugin::current() - ->enabled(false); + ->enabled(); $user = TestUser::factory()->create([ 'email' => 'developer@dutchcodingcompany.com', diff --git a/tests/TestCase.php b/tests/TestCase.php index 9896a14..e43e2c4 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -55,7 +55,7 @@ protected function registerTestPanels(): void ]) ->plugins([ FilamentDeveloperLoginsPlugin::make() - ->enabled() + ->enabled(true) ->users([ 'Administrator' => 'developer@dutchcodingcompany.com', ])