FilamentF
Filamentβ€’2y ago
pinoooh

Enum in TextEntry of InfoList

Hi,
I have a model with an enum-property (cast) which I want to display in an infolist, but this gives me an Error:
TextEntry::make('model.enumProperty')

this results in Object of class App\Enums\MyEnum could not be converted to string
I don't mind converting the value e.g. using formatStateUsing on the TextEntry but the code already fails on the name.

As a workaround I can do this, but this it's not very nice πŸ™‚
TextEntry::make('model.created_at')
    ->formatStateUsing(static function (Model $model): string {
        ...
    }
}

Any idea?
Was this page helpful?