Uncheck/Un-toggle other rows when checkbox is selected

I have a column called is_primary, and I'm using Toggle. What I need is that when I turn-on the Row#1, all the other rows will uncheck/untoggle.

Now I'm using #table-repeater , it's the table version of the Repeater. So how to select all the rows to be uncheck (except for the toggle that I clicked? I'm guessing it's gonna be responsible of $set() or statePath()?

TableRepeater::make('parents_matrix')
  ->schema([
      Toggle::make('is_primary')
        ->label('Primary?')
        ->reactive()
        ->afterStateUpdated(function(Closure $get, Closure $set, Toggle $component, $state){
            if($get('is_primary')){
                $set('is_primary', false);
            }
        }),
  ])
Screen_Shot_2023-07-07_at_11.50.22_PM.png
Was this page helpful?