giapele
nested repeater with forms Actions Component
I have this stracture and I can't retrieve the cardId on the Action AssignUsers. The record has tasklist model and the arguments is empty. Can Anybody help
Repeater::make('Tasklists')
->relationship('tasklists') // Tells Filament this is a relationship
->schema([
Repeater::make('Cards')
->relationship('cards') // Tells Filament this is a relationship
->schema([...])
->extraItemActions([
Action::make('editCard')
->mountUsing(function (Forms\ComponentContainer $form, $record, array $arguments) {
preg_match_all('/\d+/', $arguments['item'], $cardId);
$cardId = $cardId[0][0];
...
]);
->form([
Split::make([
Section::make([
...
]), Section::make([ Actions::make([ Action::make("Assign Users") ->form([ TextInput::make('name'), ... ]) ->mountUsing(function (Forms\ComponentContainer $form, $record, array $arguments) { }) ]) ])->grow(false), ]) ])
]) ])
]), Section::make([ Actions::make([ Action::make("Assign Users") ->form([ TextInput::make('name'), ... ]) ->mountUsing(function (Forms\ComponentContainer $form, $record, array $arguments) { }) ]) ])->grow(false), ]) ])
]) ])
3 replies
nested repeater extraItemActions
I have 2 nested repeaters and on the second I have extraItemActions and I have mountUsing and the $record for somereason is the data from the parent repeater and not the child
here is the code:
Repeater::make('Tasklists')
->relationship('tasklists')
->schema([
TextInput::make('name')
->label('Tasklist Name')
->required(),
Repeater::make('Cards')
->relationship('cards')
->schema([... ])
->extraItemActions([
Action::make('editCard')
->icon('heroicon-o-pencil')
->mountUsing(function (Forms\ComponentContainer $form, $record) {
log::info('', ['record' => $record]);
})
->action(function ($record, array $data) {
...
})
->form([... ])
]) ])
->label('Cards') ->addActionLabel('Add New Card'), ]) ->columnSpan('full') ->grid(5) ->addActionLabel('Add New Tasklist'), ]) if I log $record->cards I get all cards but i don't know the id of the card I am currently editing
]) ])
->label('Cards') ->addActionLabel('Add New Card'), ]) ->columnSpan('full') ->grid(5) ->addActionLabel('Add New Tasklist'), ]) if I log $record->cards I get all cards but i don't know the id of the card I am currently editing
5 replies