© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
1 reply
Demon-CZ

Dependent select in attach action

I would like to make dependent select in my attach action. It would depend on the $action->getRecordSelect. How can it be done? Thanks for your answer.

This is my action:
Tables\Actions\AttachAction::make()
                    ->form(fn(Tables\Actions\AttachAction $action): array => [
                        $action->getRecordSelect(),
                        Forms\Components\Radio::make('salary_type')->default(SalaryTypeEnum::initial->value)->options([
                            SalaryTypeEnum::initial->value => 'Mzda dle mzdy v bloku',
                            SalaryTypeEnum::custom->value => 'Pevna mzda dle hodnoty',
                        ])->label('Druh mzdy')->reactive(),
                        Forms\Components\TextInput::make('salary')->label(__('Mzda'))->required()->visible(fn(
                            \Filament\Forms\Get $get
                        ) => $get('salary_type') === SalaryTypeEnum::custom->value),
                        Select::make('role')
                            ->options(
                                function(\Filament\Forms\Get $get) {
                                    //HERE I WOULD LIKE TO ADD OPTIONS THAT WILL DEPEND ON USER ID FROM THE GET RECORD SELECT
                                }
                            ),
                        Hidden::make('added_by')->default(auth()->id()),
                    ])->modalHeading(__('Priradit instruktora'))->preloadRecordSelect()->recordSelectSearchColumns([
                        'jmeno',
                        'prijmeni',
                    ])
                    })
Tables\Actions\AttachAction::make()
                    ->form(fn(Tables\Actions\AttachAction $action): array => [
                        $action->getRecordSelect(),
                        Forms\Components\Radio::make('salary_type')->default(SalaryTypeEnum::initial->value)->options([
                            SalaryTypeEnum::initial->value => 'Mzda dle mzdy v bloku',
                            SalaryTypeEnum::custom->value => 'Pevna mzda dle hodnoty',
                        ])->label('Druh mzdy')->reactive(),
                        Forms\Components\TextInput::make('salary')->label(__('Mzda'))->required()->visible(fn(
                            \Filament\Forms\Get $get
                        ) => $get('salary_type') === SalaryTypeEnum::custom->value),
                        Select::make('role')
                            ->options(
                                function(\Filament\Forms\Get $get) {
                                    //HERE I WOULD LIKE TO ADD OPTIONS THAT WILL DEPEND ON USER ID FROM THE GET RECORD SELECT
                                }
                            ),
                        Hidden::make('added_by')->default(auth()->id()),
                    ])->modalHeading(__('Priradit instruktora'))->preloadRecordSelect()->recordSelectSearchColumns([
                        'jmeno',
                        'prijmeni',
                    ])
                    })
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

dependent select in AttachAction syntax?
FilamentFFilament / ❓┊help
3y ago
dependent select filter
FilamentFFilament / ❓┊help
2y ago
Dependent select searchable
FilamentFFilament / ❓┊help
3y ago
Dependent select input
FilamentFFilament / ❓┊help
3y ago