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..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 = true): static + public function enabled(Closure | bool $value = false): static { $this->enabled = $value; 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', ])