You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any way or even work-around to cause the component to update from within the dependsOn function? Let's say for example that the field is using data from a relationship model that is also selectable on the same resource. Is there a way to do it?
BelongsTo::make('product'),
SimpleRepeatable::make('Varieties', [
Text::make('name), Number::make('percentage'),
])
->dependsOn('product', function(SimpleRepeatable$field, NovaRequest$request, Form$formData) {
$product = Product::find($formData->product);
$field->setValue($product->varieties->map(fn($p) => $p->only(['name', 'percentage'])->toArray());
// Does not work :(// I also tried the following but does not work either$field->withMeta(['rows' => $product->varieties->map(fn($p) => $p->only(['name', 'percentage'])->toArray()]);
}),
Perhaps it's only there to conditionally display the field?
The text was updated successfully, but these errors were encountered:
Is there any way or even work-around to cause the component to update from within the
dependsOn
function? Let's say for example that the field is using data from a relationship model that is also selectable on the same resource. Is there a way to do it?Perhaps it's only there to conditionally display the field?
The text was updated successfully, but these errors were encountered: