How to get record of select relationship automatically

Select::make('type_infrastructure_id')
                            ->relationship(name: 'typeInfrastructure', titleAttribute: 'nom')
                            ->createOptionForm([
                                Forms\Components\TextInput::make('nom')
                                    ->required(),
                                Toggle::make('surface')
                                    ->onColor('success')
                                    ->offColor('danger'),
                                Toggle::make('circular')
                                    ->onColor('success')
                                    ->offColor('danger'),
                                Toggle::make('volume')
                                    ->onColor('success')
                                    ->offColor('danger'),
                            ]),
                        TextInput::make('longueur')
                            ->hidden(fn(\Filament\Forms\Get $get) => $get('type_infrastructure_id') ? $type_infrastructure_id->name === '///here' : true),
Was this page helpful?