Enum with form->select
Why is it working for table->TextColumn but not for form->select?
Filament\Forms\Components\Select::getOptions(): Return value must be of type array, string returned
Solution:Jump to solution
OK a final review before we debug this:
1- is the enum class included in the resource file?
use App\Enums\TitreEnum
2- is the enum class included in the model file?...8 Replies
In your model, make sure it's like this:
protected $casts = [
'column_name' => TitreEnum::class,
]
Yes I have this in the model and it works fine for table->TextColumn
Please show the Select code block
Try moving your select outside of relationship schema. I don't believe relationships have schemas.
Sorry I miss read the code, try removing relationship
Same error : Filament\Forms\Components\Select::getOptions(): Return value must be of type array, string returned
Solution
OK a final review before we debug this:
1- is the enum class included in the resource file?
use App\Enums\TitreEnum
2- is the enum class included in the model file?
3- is it setup in protected $casts
?Thank you 1 did the trick 🙂