final class InventoryType extends Enum
{
const UNAVAILABLE = 0;
const RENTAL = 1;
const FOR_SALE = 2;
const AVAILABLE = 3;
const SOLD = 4;
}
Given Nova Resource
Nova/Inventory.php
Enum::make('Type')->attach(InventoryType::class),
In Nova, when setting value for type, it saves correctly, and on the index & detail view it displays correctly, but when on the edit form, it fails to pre-select the already chosen value, leading to upon saving, it saving a NULL value, causing a validation error, unless ->nullable() is added, but then overrides the previously selected value with NULL
Given model
Given enum
Given Nova Resource
In Nova, when setting value for type, it saves correctly, and on the index & detail view it displays correctly, but when on the edit form, it fails to pre-select the already chosen value, leading to upon saving, it saving a
NULL
value, causing a validation error, unless->nullable()
is added, but then overrides the previously selected value withNULL