F
Filament15mo ago
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]),
No description
6 Replies
krekas
krekas15mo ago
you need to provide more info
Pasteko
PastekoOP15mo 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
krekas15mo ago
That's how relations work in filament with dot Where's the problem
Pasteko
PastekoOP15mo ago
Dotted relations work for table, not forms.
krekas
krekas15mo ago
Oh. Have your read docs? You need to add relationship() But that I guess for select. But try it
Pasteko
PastekoOP15mo ago
Thanks to Dan Harrin — just wrap it in a Group and apply the relationship there Group doesnt have any styling
Want results from more Discord servers?
Add your server