How can I take the user-selected value in one form field for use in another field?

I would like to make the default() method dynamic by inserting a specific value based on the user's choice in the fk_servizio field, below is the code
                Select::make('fk_servizio')
                    ->label('ID Servizio')
                    ->options(Servizi::all()->pluck('id', 'id'))
                    ->searchable()
                    ->required(),

                TextInput::make('commissione')
                    ->label('Importo')
                    ->numeric()
                    ->minValue(Servizi::where('id', ???)->value('amount'))
                    ->default(Servizi::where('id', ???)->value('amount'))
                    ->required(),
Was this page helpful?