Remove Specific or Multiple Enum Entities Using Filament Enum Class #16404
JayDoesPHP
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone 👋 I’ve been working with enums in FilamentPHP and ran into a small question:
Let’s say I have an enum class like this:
Now, when using ->options(UserRoleEnum::class) in a Select field, Filament automatically grabs all enum cases, which is great. But in some situations, I want to exclude one or more of the enum entities — like maybe I don’t want to show Admin.
Question:
Is it possible to exclude specific cases (like just Admin) when using ->options(UserRoleEnum::class)? Or do I need to build the options array manually? Looking for a clean and reusable approach if possible.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions