Open smualex opened 4 years ago
@smualex Thanks for the time to post this. I have to install both packages to see how it handles the vue part. I'm very familiar with enums but not with these packages or even an approach to implement/emulate this behaviour in PHP.
Will take some time but I'll get back on this issue soon.
I am also having this same issue.
same issue. any updates?
Any updates?
Can you provide the stacktrace around the error? I'm looking to try and fast track a fix for this, but I don't have a working setup so I that would be helpful
The error occurs when you try to edit some resource. If you are using the enum value ContactType::Student
on dependency check, give a error Enum cannot be converted to int
, but if uses the enum function ContactType::Student()
, works properly, at least for me.
What i see, is the DependencyContainer is triyng to convert an object to integer when is passed a integer (or string) value to him, idk.
I'm going to investigate more about this, and send a PR to fix that.
cool would gladly appreciate the PR @potreco!
Enums/ContactType.php:
Contact model:
Database:
Finally in my Nova model:
This works when creating a new resource, the dependency works perfectly.
When loading the resource page, it throws the error: Object of class App\Enums\ContactType could not be converted to int
When I change the dependsOn line to this:
dependsOn('contact_type', ContactType::Student())
The page loads properly but the dependency check is now broken. If I select "Student" from my drop down it does not load the other fields. Any thoughts around this?
I am using this package for Enums: https://github.com/BenSampo/laravel-enum and this package for my Nova field: https://github.com/simplesquid/nova-enum-field