How can I add a condition in a form?
I have this code in my form:
I would need to do something like this:
return $form
->schema([
Section::make()
->schema([
Repeater::make('trofei')
->createItemButtonLabel('Add Achiviements')
->relationship('trofei')
->schema([
TextInput::make('nome'),
TextInput::make('descrizione'),
Select::make('valore')
->label('Piattaforme:')
->options([
'1' => 'Bronzo',
'2' => 'Argento',
'3' => 'Oro',
'4' => 'Platino',
])
])
])
->columns(1)
]);return $form
->schema([
Section::make()
->schema([
Repeater::make('trofei')
->createItemButtonLabel('Add Achiviements')
->relationship('trofei')
->schema([
TextInput::make('nome'),
TextInput::make('descrizione'),
Select::make('valore')
->label('Piattaforme:')
->options([
'1' => 'Bronzo',
'2' => 'Argento',
'3' => 'Oro',
'4' => 'Platino',
])
])
])
->columns(1)
]);I would need to do something like this:
if ($record->console_id == '4') {
Select::make('valore')
->label('Piattaforme:')
->options([
'1' => 'Bronzo',
'2' => 'Argento',
'3' => 'Oro',
'4' => 'Platino',
])
} else {
TextInput::make('valore'),
}if ($record->console_id == '4') {
Select::make('valore')
->label('Piattaforme:')
->options([
'1' => 'Bronzo',
'2' => 'Argento',
'3' => 'Oro',
'4' => 'Platino',
])
} else {
TextInput::make('valore'),
}