© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•10mo ago•
18 replies
amontamas

Enum select key is not the constant but the value

I tried to make a
Select
Select
field in my form with an
Enum
Enum
. I used this documentation for it: https://filamentphp.com/docs/3.x/support/enums#enum-labels
But when it is saved the values writing into the database, not the constant, what is the expected behavior (I think).
Here is the Enum: https://github.com/sajt/iingatlanegyszer-filament/blob/main/app/Enums/County.php
Here is the Model (where is the form and the cast): https://github.com/sajt/iingatlanegyszer-filament/blob/main/app/Models/City.php
And of course the resource what is using getForm from the model: https://github.com/sajt/iingatlanegyszer-filament/blob/main/app/Filament/Resources/CityResource.php
So, when I save the form the county value is 'Budapest' not BUDAPEST
GitHub
iingatlanegyszer-filament/app/Enums/County.php at main · sajt/iing...
Contribute to sajt/iingatlanegyszer-filament development by creating an account on GitHub.
iingatlanegyszer-filament/app/Enums/County.php at main · sajt/iing...
GitHub
iingatlanegyszer-filament/app/Models/City.php at main · sajt/iinga...
Contribute to sajt/iingatlanegyszer-filament development by creating an account on GitHub.
GitHub
iingatlanegyszer-filament/app/Filament/Resources/CityResource.php a...
Contribute to sajt/iingatlanegyszer-filament development by creating an account on GitHub.
Enums - Core Concepts - Filament
Solution
I needed somyhing like this:
case BUDAPEST = 'BUDAPEST';
case BUDAPEST = 'BUDAPEST';
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Filter enum value from select enum options (get all enum values but selected ones)
FilamentFFilament / ❓┊help
2y ago
enum value in Forms\Components\Select
FilamentFFilament / ❓┊help
2y ago
Select box key-value pair
FilamentFFilament / ❓┊help
2y ago
Hydrate Select with key => value state
FilamentFFilament / ❓┊help
2y ago