Enum, select and relationship

I have two tables. The first table, orders contains a relationship to the table products. Under the table products, the status of the product is stored as 1 = in stock, 2 = out of stock, 3 = no longer available. An enum is used to convert the integer 1, 2 or 3 into a label. This works fine in the products resource , but how can I get this done in the orders resource? There I now have a select field which shows the values 1, 2 or 3 based on the relationship. But I want to extract the integer values from the relationship and then use the enum to convert the values to labels. How do you do that with a select in combination with a relationship?
2 Replies
Rick Doetinchem
Rick DoetinchemOP2w ago
Bump...
toeknee
toeknee2w ago
Select::make('product_id')
->options(MyEnum::class)
Select::make('product_id')
->options(MyEnum::class)
Presuming you have scoped the section to be the product relationship.

Did you find this page helpful?