Dynamic Fields from php

Hello,
Been trying to make dynamic fields from values that comes from the php model

How am I supposed to be making dynamic fields? Considering this does not "disable" the File one making an error when using type as string?
public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Forms\Components\Card::make()
                    ->schema([
                        Forms\Components\Hidden::make('type'), // <---- useless line
                        Forms\Components\TextInput::make('name')
                            ->required()
                            ->label('Nome')
                            ->maxLength(255),
                        Forms\Components\FileUpload::make('value')
                            ->label('Arquivo')
                            ->hidden(fn (Config $record) => $record->type !== 'file')
                            ->disabled(fn (Config $record) => $record->type !== 'file'),
                        Forms\Components\Textarea::make('value')
                            ->label('Value')
                            ->hidden(fn (Config $record) => $record->type !== 'string')
                            ->disabled(fn (Config $record) => $record->type !== 'string'),
                    ])
                    ->columns(2)
            ]);
    }


I don't know if this was supposed to be made with livewire, but I guess it should work already?
the hide and disable work fine but really fails to submit
Was this page helpful?