epartment / nova-dependency-container

A Laravel Nova field container allowing to depend on other fields values
MIT License
382 stars 163 forks source link

Usage Guidance #163

Closed ghost closed 3 years ago

ghost commented 3 years ago

Disclaimer: I'm not a programmer, so pardon my lack of knowledge and proper verbiage.

If I use something like

NovaDependencyContainer::make([ Text::make('depfield') ]) ->dependsOn('is_sample', 1),

It works as expected. However the below snippet doesn't work.

NovaDependencyContainer::make([ Text::make('depfield') ]) ->dependsOn('is_sample', 'Yes'),

The belongsTo snippet from the readme doesn't work for me. Only works when i pass a numeric value as the second parameter for the dependsOn.

ghost commented 3 years ago

I was able to simply remove the relationship on my resource / model which allowed me to make a select field with options mapped out, for example: '1' => 'Consumable Multiple Use', I can now use the package without issue. I though I could target the value being presented to the database as a string, but it appears to only work with a numeric value.