© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
5 replies
Theodoros

Select many to many problem

Hello!
I have the following error in a Select field with many to many relationship.

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sshKeys' in 'field list'

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sshKeys' in 'field list'

The form contains:
Select::make('sshKeys')
                    ->multiple()
                    ->relationship('sshKeys', 'name')
                    ->required()
                    ->label('SSH Key'),
Select::make('sshKeys')
                    ->multiple()
                    ->relationship('sshKeys', 'name')
                    ->required()
                    ->label('SSH Key'),


This is the relationship in the model
public function sshKeys()
    {
        return $this->belongsToMany(SshKey::class, 'server_ssh_key');
    }
public function sshKeys()
    {
        return $this->belongsToMany(SshKey::class, 'server_ssh_key');
    }

The select field is filled successfully but when I try to save it I get the following error.


SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sshKeys' in 'field list'

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sshKeys' in 'field list'

If I do my Select as multiple then everything is working properly.

Any suggestion for the error?
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

morph to many select
FilamentFFilament / ❓┊help
15mo ago
Multiple Select Many to Many Disabled issue
FilamentFFilament / ❓┊help
13mo ago
Form Select Problem
FilamentFFilament / ❓┊help
5mo ago