Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mortezaashrafi's avatar

The default number of Builder::make

Hello, I want to have the initial number for Builder::make, for example, 1 numbers to be active at creation time, and if possible, get the number live from categorical_factors

//->add(1) <-not work or ->default(1) <-not work or ->items(1) <-not work or ??

   public static function form(Form $form): Form
{
    return $form
        ->schema([
            TextInput::make('categoric_factors')
                ->numeric()
                ->minLength(1)
                ->maxLength(12)
                ->required()
                ->label('Categoric Factors'),
            Section::make('All Generals Factorial')
                ->schema(
                    [
                        Builder::make('general_factorial')
                            ->blocks([
                                Builder\Block::make('general_factorial')
                                    ->schema([
                                        TextInput::make('name')
                                            ->label('Name')
                                            ->autofocus()
                                            ->required(),
                                        TextInput::make('units')
                                            ->label('Units')
                                            ->required(),
                                        TextInput::make('levels')
                                            ->label('Levels')
                                            ->default(2)
                                            ->disabled()
                                            ->required(),
                                        TextInput::make('level_1')
                                            ->label('Level [1]')
                                            ->required(),
                                        TextInput::make('level_2')
                                            ->label('Level [2]')
                                            ->required(),
                                    ])
                                    ->columns(5),
                            ])
                            ->addable(false)
                            ->minItems(1)
                            ->maxItems(12)
                            ->cloneable()
                            ->collapsible()
                            ->label(false)
                    ]
                )->columnSpanFull(),
        ]);
}
0 likes
0 replies

Please or to participate in this conversation.