Problem with repeater inside action (one to many relation)
My action code:
Repeater don't show 2 records and don't fill input with data?
class EditPricebookEntriesTableAction extends Action
{
public static function getDefaultName(): ?string
{
return 'edit_pricebook_entries';
}
protected function setUp(): void
{
parent::setUp();
$this
->label('Edytuj pozycje')
->modalHeading(
fn(Pricebook $record) => "Pozycje w: $record->name",
)
->icon('gmdi-edit-note-o')
->form([
Repeater::make('entries')
->addable(false)
->relationship()
->itemLabel(
function(mixed $state, mixed $record) {
ray($state, $record, $record->entries->toArray());
return '...';
},
)
->schema([
TextInput::make('price')
->label('Cena')
->required(),
]),
])
->action(function (
Pricebook $record,
array $data,
): void {
ray($data);
});
}
}
class EditPricebookEntriesTableAction extends Action
{
public static function getDefaultName(): ?string
{
return 'edit_pricebook_entries';
}
protected function setUp(): void
{
parent::setUp();
$this
->label('Edytuj pozycje')
->modalHeading(
fn(Pricebook $record) => "Pozycje w: $record->name",
)
->icon('gmdi-edit-note-o')
->form([
Repeater::make('entries')
->addable(false)
->relationship()
->itemLabel(
function(mixed $state, mixed $record) {
ray($state, $record, $record->entries->toArray());
return '...';
},
)
->schema([
TextInput::make('price')
->label('Cena')
->required(),
]),
])
->action(function (
Pricebook $record,
array $data,
): void {
ray($data);
});
}
}


1 Reply
did You try to use fill() to populate the form ? https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component#adding-the-form