Why are my enum labels not being used in my table column?
I've got this enum class
It's cast in the model...
And my column is...
I must have missed something simple, but I have no idea what.
Solution:Jump to solution
what about
$casts
instead of method?
```php
protected $casts = [
'type' => ApprovalType::class,...12 Replies
Hello try something like:
This looks ok to me and I would expect it to work.
I got this issue on beta (iirc) but now I use latest version
v4.0.4
and it's fixed. Not sure which version fix this but it works like expected nowMe too, hence my confusion
I'm still on v3 for the moment
what is showing in the TextColumn?
final
(ie. the raw value, not the label)Your code is right.
Do you have other enums that are working?
Any customization in appserviceprovider?
what is the output?
"final"
Solution
what about
$casts
instead of method?
OMG!!
Legend
Laravel version, maybe?
I think you're right. I must have been using the new syntax when it wasn't available.
Well, I hope this thread helps someone else's sanity 🙂
Many thanks again