© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
19 replies
bwurtz999

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')
$get('selections')
and
$get('../selections')
$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();
                                    }),
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();
                                    }),
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

What to use: Repeater or Key-value
FilamentFFilament / ❓┊help
2y ago
Repeater Get Value from outside schema
FilamentFFilament / ❓┊help
2y ago
Refresh repeater values when value outside repeater changes
FilamentFFilament / ❓┊help
2y ago
Repeater default value
FilamentFFilament / ❓┊help
10mo ago