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:
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 π
Any idea?4 Replies
Didn't find a solution to this problem, but I have a "workaround": use a ViewEntry, then load a table in a new livewire component within the view. In the table I can use TextColumn which has support for the enum.
->formatStateUsing(function (string $state) {
return YourEnum::from($state);
}),
No problem
thanks for your reply but the state is already cast to an enum (by the model)
So you dont need to do anything right? With enums i add ->badge() almost always but should work out of the box ..? What is the error you get?