Replies: 2 comments 1 reply
-
@chojnicki This isn't a clean way of doing things. All pure enums have a value of |
Beta Was this translation helpful? Give feedback.
0 replies
-
They are probably never going to support it. Try my package https://github.com/henzeb/enumhancer. It will allow you to use basic enums without too much hassle. |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
I described it with details and gave examples in issue that was closed: #40380
To summary: Laravel does not support basic enums, just backed ones. It is not specified anywhere in documentation, just crashes app while trying to cast one. In my opinion there is no reason to not support basic enums. Since Laravel officially supports Enums, basic one (that are described in first chapter of PHP enum documentation) should be implemented in first place before backed ones, not in other way around ;)
If we do not need integer or string enumeration, we are forced to write ugly enums like this:
instead just
Beta Was this translation helpful? Give feedback.
All reactions