Set Repeater Data from Action Form
Hello - I am trying to generate a repeater from a form action.
The form opens but without the existing data. How do I specify the model for a Repeater when it is not a part of a traditional form? Thank you
Actions::make([
Action::make('extras')
->label('')
->color('primary')
->icon('heroicon-o-plus')
->form(function ($state, $form) {
$selectedItem = TeamProfileSelectedItem::find($state['id']);
return $form
->schema([
Repeater::make('extras')
->relationship('extras')
->model($selectedItem)
->columns(2)
->schema([
TextInput::make('qty'),
TextInput::make('name')
])
])
->model($selectedItem);
})
->action(function ($data) {
dd($data);
}),
]),Actions::make([
Action::make('extras')
->label('')
->color('primary')
->icon('heroicon-o-plus')
->form(function ($state, $form) {
$selectedItem = TeamProfileSelectedItem::find($state['id']);
return $form
->schema([
Repeater::make('extras')
->relationship('extras')
->model($selectedItem)
->columns(2)
->schema([
TextInput::make('qty'),
TextInput::make('name')
])
])
->model($selectedItem);
})
->action(function ($data) {
dd($data);
}),
]),The form opens but without the existing data. How do I specify the model for a Repeater when it is not a part of a traditional form? Thank you