Open daugaard47 opened 2 years ago
Hi, daugaard47
You can change the BelongsTo to normal select and make your query:
Select::make('Type')->options(function () { return array_filter(Element::pluck('name', 'id')->toArray()); }),
Still occurring.
Another workaround if anyone runs into this. You can get the relationship loading if you tell Nova about it, by registering a top-level field. You can then set it to always be hidden.
// Problem: The BelongsTo won't load in the NovaDepdenencyContainer
// Solution: Add a BelongsTo and force-hide it.
BelongsTo::make('Template', 'template', ChecklistGroupResource::class)
->onlyOnDetail()
->hideFromDetail(),
NovaDependencyContainer::make([
BelongsTo::make('Template', 'template', ChecklistGroupResource::class)
])
->dependsOn('type', ChecklistGroupType::COMPANY_FROM_TEMPLATE),
1. If I do this:
This works.
2. If I add
BelongsTo::make('Country', 'country'),
Inside theNovaDependencyContainer
This Does Not Work:The Country list in empty.
If I move
BelongsTo::make('Country', 'country'),
outside of theNovaDependencyContainer
the Country list is populated.Is there a way to get option 2 to work?