The select-field for "Action Type" is displayed correctly, but I never see the dependency-container.
I have tried the following strings:
actionType.field
action_type.field
ActionType.field
But if I use:
->dependsOn('actionType, 4),
with the given ID, everything works. Unfortunately I want to use the "field"-column, but this doesn't work.
MY WORKAROUND FOR NOW:
I have created two functions to return me an array with the IDs for all rows with the give "field" (type).
With ->dependsOnIn('actionType', $this->getTypeIds('t')); everything works fine.
public function fields(NovaRequest $request)
{
return [
BelongsTo::make('Post'),
BelongsTo::make('Action Type'),
DependencyContainer::make([Text::make($this->getTypeLabel('t'), 'content')])->dependsOnIn('actionType', $this->getTypeIds('t')),
DependencyContainer::make([Number::make($this->getTypeLabel('n'), 'content')])->dependsOnIn('actionType', $this->getTypeIds('n')),
DependencyContainer::make([Boolean::make($this->getTypeLabel('b'), 'content')])->dependsOnIn('actionType', $this->getTypeIds('b')),
Date::make('Happened When')
];
}
public function getTypeIds($type) {
return \App\Models\ActionType::where('field', $type)->pluck('id');
}
public function getTypeLabel($type) {
return \App\Models\ActionType::where('field', $type)->field_label;
}
Big thanks to Alex, to answer me so fast via e-mail and suggest me to create this issue.
I have two tables called ActionTypes and RunActions.
RunActions has a column action_type_id. ActionTypes has a column field.
In App\Models\RunAction:
In App\Nova\RunAction:
The select-field for "Action Type" is displayed correctly, but I never see the dependency-container. I have tried the following strings:
But if I use:
->dependsOn('actionType, 4),
with the given ID, everything works. Unfortunately I want to use the "field"-column, but this doesn't work.MY WORKAROUND FOR NOW:
I have created two functions to return me an array with the IDs for all rows with the give "field" (type). With
->dependsOnIn('actionType', $this->getTypeIds('t'));
everything works fine.Big thanks to Alex, to answer me so fast via e-mail and suggest me to create this issue.