© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•14mo ago•
6 replies
galli.roberto

Repeater DeleteAction

Repater context

why visible is called twice?
the first time without $activeItem.

I am trying to hide delete button only for some item.

In this way the button result disabled, not hidden.


->visible(function (array $arguments, Repeater $component): bool {
      $items = $component->getState();
      $activeItem = $items[$arguments['item'] ?? null] ?? null;

      dump($activeItem);
      if (!$activeItem || !$activeItem['role_id']) return true;
      return !self::$ownerRoles->find($activeItem['role_id']);
  })->color(function (array $arguments, Repeater $component): string {
      $items = $component->getState();
      $activeItem = $items[$arguments['item'] ?? null] ?? null;

      //dump($activeItem);
      if (!$activeItem || !$activeItem['role_id']) return 'danger';
      return !self::$ownerRoles->find($activeItem['role_id']) ? 'danger' : 'gray';
  })
->visible(function (array $arguments, Repeater $component): bool {
      $items = $component->getState();
      $activeItem = $items[$arguments['item'] ?? null] ?? null;

      dump($activeItem);
      if (!$activeItem || !$activeItem['role_id']) return true;
      return !self::$ownerRoles->find($activeItem['role_id']);
  })->color(function (array $arguments, Repeater $component): string {
      $items = $component->getState();
      $activeItem = $items[$arguments['item'] ?? null] ?? null;

      //dump($activeItem);
      if (!$activeItem || !$activeItem['role_id']) return 'danger';
      return !self::$ownerRoles->find($activeItem['role_id']) ? 'danger' : 'gray';
  })


attachment show the double call

This hide the button
->extraAttributes(function (array $arguments, Repeater $component): array {
    $items = $component->getState();
    $activeItem = $items[$arguments['item'] ?? null] ?? null;

    if (!$activeItem || !$activeItem['role_id']) return [];
    return !self::$ownerRoles->find($activeItem['role_id']) ? [] : ['class' => 'hidden'];
})
->extraAttributes(function (array $arguments, Repeater $component): array {
    $items = $component->getState();
    $activeItem = $items[$arguments['item'] ?? null] ?? null;

    if (!$activeItem || !$activeItem['role_id']) return [];
    return !self::$ownerRoles->find($activeItem['role_id']) ? [] : ['class' => 'hidden'];
})
image.png
image.png
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Repeater deleteAction
FilamentFFilament / ❓┊help
2y ago
Repeater deleteAction
FilamentFFilament / ❓┊help
3y ago
Repeater deleteAction Label Not Working
FilamentFFilament / ❓┊help
9mo ago
repeater deleteAction get deleted record to handle it?
FilamentFFilament / ❓┊help
13mo ago