Closed muhajirrr closed 1 year ago
Hi @danharrin, thanks for your hard work. My previous issue was fixed in the latest release, but i found that the defaults value still doesn't work for repeater with relationship.
The ->default()
in the following code is not working.
Forms\Components\Repeater::make('prices')
->relationship()
->deletable(false)
->reorderable(false)
->addable(false)
->columns(2)
->default(
CustomerType::all()->map(fn (CustomerType $customerType) => [
'customer_type_id' => $customerType->id,
'price' => 0,
])->toArray()
)
->schema([
Forms\Components\Select::make('customer_type_id')
->relationship('customerType', 'name')
->searchable()
->preload()
->disabled()
->required(),
Forms\Components\TextInput::make('price')
->numeric()
->required(),
]),
I have updated the reproduction repository, you can check it.
Package
filament/filament
Package Version
v3.0.50
Laravel Version
v10.23.1
Livewire Version
No response
PHP Version
PHP 8.2.6
Problem description
When setting a default value for the Repeater, the default value is not set.
Expected behavior
The default value should be set.
Steps to reproduce
Reproduction repository
https://github.com/muhajirrr/filament-repeater-defaults-issue
Relevant log output
No response