Set Repeater Data from Action Form

Hello - I am trying to generate a repeater from a form action.
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
Solution:
its fillForm
Jump to solution
5 Replies
toeknee
toeknee3mo ago
->model() or ->fillUsing() ?
bwurtz999
bwurtz999OP3mo ago
I've tried model and it doesn't seem to work I've never heard of fillUsing before I will give that a shot
Solution
toeknee
toeknee3mo ago
its fillForm
bwurtz999
bwurtz999OP3mo ago
ah ok that makes more sense That worked! Thank you!!!
Want results from more Discord servers?
Add your server