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',
])
})
0 Replies