Skip to content

Error with enum cast and select field #3060

@keasy9

Description

@keasy9

If model field casted as enum class, e.g.:

protected $casts = [
    'user_type' => UserTypeEnum::class,
];

and select field is used to edit it:

Select::make('user_type')->options(
    collect(UserTypeEnum::cases())
        ->mapWithKeys(fn($case) => [$case->value => $case->title()])
),

fatal php error is appearing:
Image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions