12T
Fields Repeater, can't be deleted
I think it's not working properly. I've attached a video of the problem.
my code.
Forms\Components\Section::make('Port')
->description('ระบุ Port Numer หรือชื่อ Port Name ที่ต้องการเชื่อต่อ')
->schema([
Forms\Components\Repeater::make('ports')
->label('')
->schema([
Forms\Components\Select::make('port_type')
->label('Port Type (โดยทั่วไปจะเป็น TCP)')
->options([
'tcp' => 'TPC',
'udp' => 'UDP',
])
->live()
->default('tcp')
->native(false)
->required(),
Forms\Components\TextInput::make('port_number')
->label('Port Namber')
->id('port_number')
->maxLength(255)
->required(fn (Get $get): string => !$get('port_name')),
Forms\Components\TextInput::make('port_name')
->label('Port Name')
->maxLength(255)
->required(fn (Get $get): string => !$get('port_number')),
])
->itemLabel(fn (array $state): ?string => strtoupper($state['port_type'] ?? ''))
->reorderableWithDragAndDrop(false)
->addActionLabel('Add Port')
->cloneable()
->minItems(1)
->columns(3),
])
->collapsible()
->compact()
Forms\Components\Section::make('Port')
->description('ระบุ Port Numer หรือชื่อ Port Name ที่ต้องการเชื่อต่อ')
->schema([
Forms\Components\Repeater::make('ports')
->label('')
->schema([
Forms\Components\Select::make('port_type')
->label('Port Type (โดยทั่วไปจะเป็น TCP)')
->options([
'tcp' => 'TPC',
'udp' => 'UDP',
])
->live()
->default('tcp')
->native(false)
->required(),
Forms\Components\TextInput::make('port_number')
->label('Port Namber')
->id('port_number')
->maxLength(255)
->required(fn (Get $get): string => !$get('port_name')),
Forms\Components\TextInput::make('port_name')
->label('Port Name')
->maxLength(255)
->required(fn (Get $get): string => !$get('port_number')),
])
->itemLabel(fn (array $state): ?string => strtoupper($state['port_type'] ?? ''))
->reorderableWithDragAndDrop(false)
->addActionLabel('Add Port')
->cloneable()
->minItems(1)
->columns(3),
])
->collapsible()
->compact()
7 replies