Dynamic fields based on a select option

Create time select to dynamic input field showing but edit time selected dropdown base input not showing.

         Select::make('type')
                        ->relationship('customerType', 'type')
                        ->live()
                        ->afterStateUpdated(fn (Select $component) => $component
                            ->getContainer()
                            ->getComponent('dynamicTypeFields')
                            ->getChildComponentContainer()
                            ->fill()),

                        Grid::make(2)
                            ->schema(fn (Get $get): array => match ($get('type')) {
                                '1' => self::ipFields(),
                                '2' => self::pppoeFields(),
                                '3' => self::hotspotFields(),
                                default => [],
                            })->key('dynamicTypeFields'),
Was this page helpful?