popica's avatar

Display Select field with data from ENUM table field

Hi, I want to display data from a ENUM DB table column in a Nova select field. Its name is "status" and has options like "draft", "pending", "active"... How can I use the Select field to display these ENUM values and also the one chosen to be the default one? At the moment when I am in Nova Edit or New sections the select dropdown is empty, not populated. I can see the chosen enum value only in the Browse and Details sections. Thanks!

0 likes
2 replies
jdc1898's avatar

I use something like this:

Select::make('Category', 'CategoryId')->options(\App\Models\Inventory\Category::pluck('CategoryName', 'id'))

1 like
sekar_nat's avatar

That was a good solution for dropdown. But if we have hundreds of options, is there a way can we add search the term and look up?

Please or to participate in this conversation.