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]),
No description
6 Replies
krekas
krekas2y ago
you need to provide more info
Pasteko
PastekoOP2y ago
We can't do dotted relations in forms right? How can I achieve that "Toggle::make('details.state')" without adding a group, card or section?
krekas
krekas2y ago
That's how relations work in filament with dot Where's the problem
Pasteko
PastekoOP2y ago
Dotted relations work for table, not forms.
krekas
krekas2y ago
Oh. Have your read docs? You need to add relationship() But that I guess for select. But try it
Pasteko
PastekoOP2y ago
Thanks to Dan Harrin — just wrap it in a Group and apply the relationship there Group doesnt have any styling

Did you find this page helpful?