Select with enums data #2505
Unanswered
FahrenheitIndi
asked this question in
Q&A
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.
-
Hi @tabuna hope you're well.

I can't get a value from Enums in the selector
Enum class
enum Status: string { case Published = 'published'; case Draft = 'draft'; case Archived = 'archived'; }
Model class
class Article extends Model { protected $casts = [ 'status' => Status::class ]; }
Select
Select::make('article.status.value') ->title(__('Status')) ->options(Status::values()) ->help(__('Choose a post status or leave the current status')),
But when you open the screen with the layout edit, select gets the value published, although it has a draft in the database
Specify the target in the layouts. I passed it to select value, but still get enums enumeration instead of database record + enums combing
Beta Was this translation helpful? Give feedback.
All reactions