laravel-nova-nested-form
laravel-nova-nested-form copied to clipboard
NovaDependencyContainer
Unfortunately it's not working with the package NovaDependencyContainer.
I use that dependency-container to show certain attributes, when something is selected in the form. But when I use NestedForms and I select something in the select-box, nothing happens.
Is there a workaround? Would be great to use both in the same Nova model.
@yassipad What could be causing this package not work with:
https://github.com/dillingham/nova-ajax-select

https://github.com/orlyapps/nova-belongsto-depend

I'm guessing both are using the "attribute" value of each field, which needs to be changed for this package to work; you would have have several times the same attribute otherwise.
Example:
If a User has Posts, instead of having the default attributes ('name', 'email', 'content', 'title', 'content', 'title'), I need to transform them into nested attributes ('name', 'email', 'posts[0][title]', 'posts[0][content]', 'posts[1][title]','posts[1][content]').
Yes, it seems there are a handful of very useful field packages that many people use, that throw monkey wrenches into others. Like yassipad guessed, this is almost certainly due to the way these fields are using the attribute field.
You will see fields like epartment/dependency-container, dillingham/nova-ajax-select, and 64robots/json have issues. Ex. I had to modify 64robots/json to specifically look for dependency-container fields and handle one extra level of depth. Seems to be a similar issue here, as well as others.
Sure you could go one more level deep with the attribute abstraction, but seems like it would be hard to find the line to draw, at exactly how far deep to go.
Maybe as a way to fix some of this, Nova should adopt several more fields into their core. It would still require other fields depending on attribute (like this one) to have to check for field types, but at least they would be standard field types with standard names, and not the random name of a 3rd party one the dev decided on. Or even a trait called usesAttributes that could be checked for with instanceof or something. Just a thought.
if anyone is interested, this is a 'fix' for https://github.com/orlyapps/nova-belongsto-depend
https://github.com/orlyapps/nova-belongsto-depend/pull/39
it works on both a nested form or directly in the resource
@Fabio1988 I created a fork of nova-dependecy-container. Here you can find a container version that works inside a nested form. https://github.com/alberto-bottarini/nova-dependency-container
Could you please help me in testing? If everything works, I will do a PR.
Please upvote my PR https://github.com/epartment/nova-dependency-container/pull/146
I fixed conflicts in the new PR. Please upvote. https://github.com/epartment/nova-dependency-container/pull/202