Here is what I have currently ... https://f1pickem.org/repeater.png
Sep 1, 2023
4
Level 1
Filament: display the id of each repeater
I have a set of repeaters and would like to display the ID of each one to help the user know which one they were working with. I would like to place this in the ->itemLabel('1st place')
I apologize, I am struggling with adding an image showing what the page looks like.
return [
Forms\Components\Repeater::make('players')
->schema([
Forms\Components\Select::make('name')
->label('Choose driver:')
->options(function (callable $get) {
$players = $get('../../players');
$idsAlreadyUsed = [];
foreach($players as $repeater) {
if(! in_array($repeater['name'], $idsAlreadyUsed)
&& $repeater['name'] !== null
&& $repeater['name'] != $get('name')) {
$idsAlreadyUsed[] = $repeater['name'];
}
}
return Player::whereNotIn('id', $idsAlreadyUsed)->pluck('name', 'id')->toArray();
})
->reactive()
->required()
])
->itemLabel('1st Place')
->disableLabel()
->defaultItems(10)
->disableItemCreation()
->disableItemDeletion()
->disableItemMovement()
];
Please or to participate in this conversation.