FEATURE REQUEST: Cast backed enums into string or int in blade #41181
Unanswered
avidianity
asked this question in
Ideas
Replies: 2 comments
-
In the meantime maybe you can use https://github.com/henzeb/enumhancer/blob/main/docs/functions.md#value |
Beta Was this translation helpful? Give feedback.
0 replies
-
Just to let you know, the newest version of the package mentioned above now supports what you proposed. https://github.com/henzeb/enumhancer/blob/main/docs/blade.md |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Say we have this sample model:
When casting eloquent properties with enums, we have to do this everytime we try to render it, otherwise it throws error:
{{ $model->foo->value }}
It would be great if the renderer/view engine can recognize that it's an enum and automatically return it's string/int version so we can still render it like so:
{{ $model->foo }}
probably something like
Beta Was this translation helpful? Give feedback.
All reactions