disable field dynamically but save it in db
Hi, I need to dynamically disable a Togglebut I have to save the field: how come it doesn’t work ?
...
switch ($tipo) {
case SoggettoTipo::Contraente:
$is_contraente = true;
$is_contraente_disabled = true;
break;
case SoggettoTipo::DlDecRup:
$is_dldecrup = true;
$is_dldecrup_disabled = true;
break;
}
...
Toggle::make('is_contraente')
->default($is_contraente)
->dehydrated()
->disabled($is_contraente_disabled),...
switch ($tipo) {
case SoggettoTipo::Contraente:
$is_contraente = true;
$is_contraente_disabled = true;
break;
case SoggettoTipo::DlDecRup:
$is_dldecrup = true;
$is_dldecrup_disabled = true;
break;
}
...
Toggle::make('is_contraente')
->default($is_contraente)
->dehydrated()
->disabled($is_contraente_disabled),Solution
Perfect !!
Thanks
Forms\Components\Toggle::make('is_contraente')
->default($is_contraente)
->disabled($is_contraente_disabled)
->dehydrated(), Forms\Components\Toggle::make('is_contraente')
->default($is_contraente)
->disabled($is_contraente_disabled)
->dehydrated(),Thanks