Clear
Clear
FFilament
Created by Clear on 2/26/2024 in #❓┊help
Dynamic form for a products attributes
I want to display a form where the product attributes can be update. Example db schema:
products
id
slug
name

attributes
id
name
sort
weight


attribute_values
id
attribute_id
value
computed

products_attribute_values
id
attribute_id
value_id
comment
products
id
slug
name

attributes
id
name
sort
weight


attribute_values
id
attribute_id
value
computed

products_attribute_values
id
attribute_id
value_id
comment
I'm able to generate the fields using
foreach ($attributes as $attribute){
$fields[] = Forms\Components\TextInput::make('attributes.' . $attribute->id)
->label($attribute->name)->default('value!');
}
foreach ($attributes as $attribute){
$fields[] = Forms\Components\TextInput::make('attributes.' . $attribute->id)
->label($attribute->name)->default('value!');
}
But the I can't set the field value, instead of seeing "value!" the input field is empty.
3 replies