Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
>
@foreach ($items as $itemKey => $item)
@php
$itemLabel = $getItemLabel($itemKey);
$itemLabel = $getItemLabel($itemKey, $loop->iteration);
Copy link
Member

@People-Sea People-Sea Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be $loop->index instead? Since the injected parameter is named $index, it should start at 0 to match convention.

$visibleExtraItemActions = array_filter(
$extraItemActions,
fn (Action $action): bool => $action(['item' => $itemKey])->isVisible(),
Expand Down
3 changes: 2 additions & 1 deletion packages/forms/src/Components/Repeater.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -1202,6 +1202,7 @@ public function getItemLabel(string $key): string | Htmlable | null
'schema' => $container,
'state' => $container->getStateSnapshot(),
'uuid' => $key,
'index' => $index,
]);
}

Expand Down