Allow customizing environment detection in EnvironmentIndicatorPlugin #36

Merged
robertvansteen merged 1 commit from claude/configurable-environment-gvPgY into main 2026-02-24 16:35:58 +00:00
robertvansteen commented 2026-02-24 16:11:14 +00:00 (Migrated from github.com)

Summary

This PR adds the ability to customize how the environment is detected in the EnvironmentIndicatorPlugin, allowing users to override the default app()->environment() behavior with a static string or closure.

Key Changes

  • Added a new $environment property to store the custom environment value
  • Added environment(string|Closure $environment) method to configure a custom environment resolver
  • Added getEnvironment() method that evaluates the custom environment or falls back to app()->environment()
  • Updated all references to app()->environment() throughout the plugin to use $plugin->getEnvironment() instead
  • Updated documentation with usage examples showing how to override environment detection
## Summary This PR adds the ability to customize how the environment is detected in the EnvironmentIndicatorPlugin, allowing users to override the default `app()->environment()` behavior with a static string or closure. ## Key Changes - Added a new `$environment` property to store the custom environment value - Added `environment(string|Closure $environment)` method to configure a custom environment resolver - Added `getEnvironment()` method that evaluates the custom environment or falls back to `app()->environment()` - Updated all references to `app()->environment()` throughout the plugin to use `$plugin->getEnvironment()` instead - Updated documentation with usage examples showing how to override environment detection
pxlrbt commented 2026-02-24 16:36:04 +00:00 (Migrated from github.com)

Thanks!

Thanks!
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pxlrbt/filament-environment-indicator!36
No description provided.