© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
3 replies
JJSanders

Add + button next to select button in repeater conditionally

Hello, I am trying to add a + sign in my repeater when the value of the select-box is empty or when the record in the repeater is new.
At the moment not succeeding. This is my code. Do you have any suggestions?

        return [
            Select::make('product_id')
                (.....)
                //====>>>> This is the part of the code the question is about <<<<<============
                ->when(!filled('product'), function (Select $select) {
                    return $select
                        ->relationship('product', 'description', function (Builder $query, Get $get) {
                            $query->where('brand_id', '=', $get('../../brand_id'));
                        })
                        ->getOptionLabelFromRecordUsing(fn(Product $product): ?string => $product->description)
                        ->createOptionForm(function (Get $get) {
                            return [
                                Hidden::make('brand_id')
                                    ->default($get('../../brand_id')),
                                Hidden::make('supplier_id')
                                    ->default($get('../../supplier_id')),
                                TextInput::make('item_code')
                                    ->label('Artikelcode')
                                    ->required()
                                    ->maxLength(255),
                                   });
                    }),
            ];
        );
        return [
            Select::make('product_id')
                (.....)
                //====>>>> This is the part of the code the question is about <<<<<============
                ->when(!filled('product'), function (Select $select) {
                    return $select
                        ->relationship('product', 'description', function (Builder $query, Get $get) {
                            $query->where('brand_id', '=', $get('../../brand_id'));
                        })
                        ->getOptionLabelFromRecordUsing(fn(Product $product): ?string => $product->description)
                        ->createOptionForm(function (Get $get) {
                            return [
                                Hidden::make('brand_id')
                                    ->default($get('../../brand_id')),
                                Hidden::make('supplier_id')
                                    ->default($get('../../supplier_id')),
                                TextInput::make('item_code')
                                    ->label('Artikelcode')
                                    ->required()
                                    ->maxLength(255),
                                   });
                    }),
            ];
        );
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Add Custom Button to Repeater
FilamentFFilament / ❓┊help
3y ago
Repeater Add button - Icon
FilamentFFilament / ❓┊help
15mo ago
Repeater: How can I conditionally show/hide Delete button in Repeater?
FilamentFFilament / ❓┊help
2y ago
Conditionally display either checkbox or radio button in Repeater
FilamentFFilament / ❓┊help
7mo ago