FilamentF
Filament2y ago
Kyle

How do I get the index of the current TextInput inside a simple Repeater?

I have a simple repeater, inside it is a TextInput. I just want to get the index of the current TextInput so that I can show it as the prefix. Maybe something like,

Repeater::make('scores')
  ->simple(
    TextInput::make('score')
      ->prefix(fn ($index) => $index + 1)
      ->required()
  )

I tried my best to look everywhere on how I can do this but I just can't find an answer.

I would be really grateful if anyone can give me hints to this... If it's impossible, please tell me so that I can try to find another way.

Thank you very much in advance.
Was this page helpful?