Enum is cast when creating but not editing
I have the following model (simplified)
and the following form resource
In the above example, when I create a new
However, when I edit the resource, the same call returns a
Am I doing something wrong or is this just how filament works?
and the following form resource
In the above example, when I create a new
Config, the $get('config_type') call returns and ConfigType enum as expectedHowever, when I edit the resource, the same call returns a
string (with the value of the enum) instead of an enum object as expected.Am I doing something wrong or is this just how filament works?
Solution
it seems the issue is on your ->default()
it should be ->default(ConfigType::MAPPER->value)
you can keep the options(), it is already correct. no enum() needed.
it should be working on create and edit
it should be ->default(ConfigType::MAPPER->value)
you can keep the options(), it is already correct. no enum() needed.
it should be working on create and edit