diff --git a/packages/forms/resources/views/components/repeater/index.blade.php b/packages/forms/resources/views/components/repeater/index.blade.php index 1adf168bc9f..a47f179b015 100644 --- a/packages/forms/resources/views/components/repeater/index.blade.php +++ b/packages/forms/resources/views/components/repeater/index.blade.php @@ -91,7 +91,7 @@ > @foreach ($items as $itemKey => $item) @php - $itemLabel = $getItemLabel($itemKey); + $itemLabel = $getItemLabel($itemKey, $loop->iteration); $visibleExtraItemActions = array_filter( $extraItemActions, fn (Action $action): bool => $action(['item' => $itemKey])->isVisible(), diff --git a/packages/forms/src/Components/Repeater.php b/packages/forms/src/Components/Repeater.php index 1228663aea5..2bf2384b8fc 100644 --- a/packages/forms/src/Components/Repeater.php +++ b/packages/forms/src/Components/Repeater.php @@ -1191,7 +1191,7 @@ public function getCachedExistingRecords(): Collection )); } - public function getItemLabel(string $key): string | Htmlable | null + public function getItemLabel(string $key, ?int $index = null): string | Htmlable | null { $container = $this->getChildSchema($key); @@ -1202,6 +1202,7 @@ public function getItemLabel(string $key): string | Htmlable | null 'schema' => $container, 'state' => $container->getStateSnapshot(), 'uuid' => $key, + 'index' => $index, ]); }