orchidsoftware / orchidsoftware/platform

Error with enum cast and select field

Open
#3,060 2 comments 0 reactions 1 assignee View on GitHub

@tabuna is already working on this.

Since Nov 10, 2025.

Errors
Dominant language
PHP
Stars
4.8k
Forks
663
Avg merge
1d 9h
Merged PRs (30d)
7

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.