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
-
Hi @tabuna hope you're well.
![2023-01-20_01-22-38](https://user-images.githubusercontent.com/7422912/213575753-8661b077-5bbd-4802-8b22-0478c623b872.png)
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