Repeater Item Label

Hi fellas, Is there a way to set default item labels for Repeater, for example when i am on create form i have 3 default items, I need to set it be id of current it example: Sector {$id} from repeater item. And when i add automataclly to be Sector i++..
Repeater::make('antenna_mounts')
->label(__('global.ssr.antenna_mounts_sectors'))
->columns(1)
->grid(3)
->columnSpanFull()
->schema([
Hidden::make('id')
->live()
->dehydrated(true),
])
->itemLabel(fn (array $state): ?string => __('global.ssr.sector').$state['id'] ?? null)
->cloneable()
->collapsible()
->defaultItems(count: 3)
->reorderable(condition: true),
Repeater::make('antenna_mounts')
->label(__('global.ssr.antenna_mounts_sectors'))
->columns(1)
->grid(3)
->columnSpanFull()
->schema([
Hidden::make('id')
->live()
->dehydrated(true),
])
->itemLabel(fn (array $state): ?string => __('global.ssr.sector').$state['id'] ?? null)
->cloneable()
->collapsible()
->defaultItems(count: 3)
->reorderable(condition: true),
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?