Omar Alnabris
Omar Alnabris
FFilament
Created by Omar Alnabris on 4/20/2025 in #❓┊help
How to stop "Attach" action in a Relation Manager if the parent resource form is dirty (unsaved)?
I tried to use livewire event and listener to pass the changes from parent resource to child relation manger, but for some reason it didn't work too.
3 replies
FFilament
Created by renatoalvarez on 4/16/2025 in #❓┊help
Moving Filament Repeater addAction to Actions Toolbar
You can achieve this using ->extraItemActions() on your repeater to insert a new item after the currently clicked one. Here’s an example:
Repeater::make('members')
->schema([
// your repeater fields
])
->extraItemActions([
Action::make('addNewItem')
->icon('heroicon-m-plus')
->action(function (array $arguments, Repeater $component): void {
$newUuid = Str::uuid()->toString();
$items = $component->getState();
$newItems = [];

foreach ($items as $key => $value) {
$newItems[$key] = $value;

if ($key === $arguments['item']) {
$newItems[$newUuid] = [];
}
}

$component->state($newItems);
$component->getChildComponentContainer($newUuid)->fill();
$component->callAfterStateUpdated();
}),
])
->addable(false);
Repeater::make('members')
->schema([
// your repeater fields
])
->extraItemActions([
Action::make('addNewItem')
->icon('heroicon-m-plus')
->action(function (array $arguments, Repeater $component): void {
$newUuid = Str::uuid()->toString();
$items = $component->getState();
$newItems = [];

foreach ($items as $key => $value) {
$newItems[$key] = $value;

if ($key === $arguments['item']) {
$newItems[$newUuid] = [];
}
}

$component->state($newItems);
$component->getChildComponentContainer($newUuid)->fill();
$component->callAfterStateUpdated();
}),
])
->addable(false);
4 replies