Use $get to find repeater value

Hello - I am using a repeater on a form. Within the repeater, I want the user to select an option from a list. If a new section is added to the repeater, I do not want the category that has already been selected above to be an option. I am trying to use $get to find the repeater but nothing seems to work. I've tried $get('selections') and $get('../selections') but nothing has worked. What am I missing?

Repeater::make('selections')
                            ->columns(4)
                            ->disableItemMovement()
                            ->maxWidth('max-w-7xl')
                            ->minItems(1)
                            ->createItemButtonLabel('Add Category')
                            ->collapsible()
                            ->reactive()
                            ->schema([
                                Select::make('menu_category')
                                    ->label('Category')
                                    ->required()
                                    ->options(function(callable $get) {
                                        $repeater = $get('../selections');
                                        $idsAlreadyUsed = [];
                                        if(isset($repeater[0])) {
                                            foreach($repeater as $section) {
                                                if(in_array($section['menu_category'], $idsAlreadyUsed) === false) {
                                                    $idsAlreadyUsed[] = $section['menu_category'];
                                                }
                                            }
                                        }
                                        return MenuCategory::whereNotIn('id', $idsAlreadyUsed)->pluck('name', 'id')->toArray();
                                    }),
Was this page helpful?