F
Filament15mo ago
Kaan

Custom Page Repeater Delete Item

I am working on a project using Filament V3 and facing an issue while trying to implement a custom delete method within a Repeater component. My aim is to allow the user to delete individual records within the Repeater component. I have created a delete method in my page class, and I am trying to link this method to the deleteAction property of the Repeater component, but it seems like the delete method is not being triggered. Below is the relevant code: https://gist.github.com/kaanxweb/8cdba1bf2c8b67f2a1706cdc4900509f
1 Reply
Kaan
KaanOP15mo ago
public function form(Form $form): Form
{
return $form
->schema([
Repeater::make('partners')
->label('Pozisyon')
->schema([
TextInput::make('name'),
TextInput::make('website'),
FileUpload::make('logo')
->image()
->directory('partners')
->required(),
])
->reorderable()
->reorderableWithButtons()
->orderColumn('position')
->addable(false)
->deletable(true)
->deleteAction(fn (Action $action) => $action->requiresConfirmation()),
])->statePath('data');
}
public function form(Form $form): Form
{
return $form
->schema([
Repeater::make('partners')
->label('Pozisyon')
->schema([
TextInput::make('name'),
TextInput::make('website'),
FileUpload::make('logo')
->image()
->directory('partners')
->required(),
])
->reorderable()
->reorderableWithButtons()
->orderColumn('position')
->addable(false)
->deletable(true)
->deleteAction(fn (Action $action) => $action->requiresConfirmation()),
])->statePath('data');
}

Did you find this page helpful?