Closed marcoguido closed 1 year ago
I got in the same situation, I have made it work in my code in the same way, and I was thinking about submitting a PR exactly like this - so I'm happy to see that it's already there and I hope it will be merged.
I hope that too 😉
Any idea if/when this might be merged? Would love to switch from our custom solution to this package but we need Enum support too.
@marcoguido @lorenzolosa @binaryfire Tagged at 1.3.4
Thanks @marcoguido 🙌
With this PR, users will be able to make use of this trait also if the
type
column is casted to anEnum
instance.In one of my projects, for example, I have the following situation, where UserType is a backed enum holding possible values.
When creating a new model instance Laravel resolves the cast providing the proper
Enum
instance, leading to an exception being thrown inclassFromAlias
where the$aliasOrClass
is not a simple string, but theEnum
instance.