© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
10 replies
Pasteko

Form Toggle relationship

Hi!
How ca I have a relationship for this toggle and keep this layout?

            Group::make()                
                ->schema([
                    Section::make('Connexion')                                                
                        ->schema([
                            TextInput::make('name')
                                ->label('Utilisateur')
                                ->required(),
                            TextInput::make('email')
                                ->email()
                                ->label('E-mail')
                                ->required(),
                            TextInput::make('password')
                                ->password()
                                ->dehydrateStateUsing(fn ($state) => Hash::make($state))
                                ->dehydrated(fn ($state) => filled($state))
                                ->required(fn (string $context): bool => $context === 'create')
                                ->label('Mot de passe'),
                            Toggle::make('state')                            
                                ->onIcon('heroicon-m-bolt')
                                ->offIcon('heroicon-m-user')
                                ->onColor('success')
                                ->offColor('danger')
                                ->label('Actif')
                                ->inline(false),
                        ])
                        ->icon('heroicon-o-lock-closed')
                        ->columns(2)                
                ])
                ->columnSpan(['lg' => 2]),
            Group::make()                
                ->schema([
                    Section::make('Connexion')                                                
                        ->schema([
                            TextInput::make('name')
                                ->label('Utilisateur')
                                ->required(),
                            TextInput::make('email')
                                ->email()
                                ->label('E-mail')
                                ->required(),
                            TextInput::make('password')
                                ->password()
                                ->dehydrateStateUsing(fn ($state) => Hash::make($state))
                                ->dehydrated(fn ($state) => filled($state))
                                ->required(fn (string $context): bool => $context === 'create')
                                ->label('Mot de passe'),
                            Toggle::make('state')                            
                                ->onIcon('heroicon-m-bolt')
                                ->offIcon('heroicon-m-user')
                                ->onColor('success')
                                ->offColor('danger')
                                ->label('Actif')
                                ->inline(false),
                        ])
                        ->icon('heroicon-o-lock-closed')
                        ->columns(2)                
                ])
                ->columnSpan(['lg' => 2]),
image.png
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Center form toggle
FilamentFFilament / ❓┊help
3y ago
Form HasOne relationship
FilamentFFilament / ❓┊help
3y ago
Dynamic toggle columns based on relationship
FilamentFFilament / ❓┊help
5mo ago