© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
3 replies
Remi Hindriks

Spatie Translatable Plugin and relationship fieldset

My
Page
Page
model has a
MorphOne
MorphOne
relationship to the
Seo
Seo
model. The
Seo
Seo
model has columns like title and description.

In my
PageResource
PageResource
i have a fieldset for the
Seo
Seo
relationship:

Forms\Components\Fieldset::make('seo')
            ->relationship(name: 'seo')
            ->schema([
                Forms\Components\TextInput::make('title')
                    ->label(__('SEO title'))
                    ->string(),

                Forms\Components\Textarea::make('description')
                    ->label(__('SEO description'))
                    ->string(),
              ]),
Forms\Components\Fieldset::make('seo')
            ->relationship(name: 'seo')
            ->schema([
                Forms\Components\TextInput::make('title')
                    ->label(__('SEO title'))
                    ->string(),

                Forms\Components\Textarea::make('description')
                    ->label(__('SEO description'))
                    ->string(),
              ]),


This works just fine. Until i add the Spatie Translatable Plugin.

I found out adding the relationship name to the translatable array on the page model made the language selector "work" on the related textInputs:
public array $translatable = ['title', 'seo'];
public array $translatable = ['title', 'seo'];


Now when i switch languages using the LocaleSwitcher on the create or edit screen, the inputs seem to store the data per language.

When i enter just 1 language, no issue, but when i set multiple language variables and save it, i get an error

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

Now all of a sudden the
seo
seo
isn't stored as a relationship but as a column on the page model.

the raw query is:
update 
update 
pages
 set 
 set 
title
 = ?, 
 = ?, 
seo
 = ?, 
 = ?, 
pages
.
.
updated_at
 = ? where 
 = ? where 
id
 = ?
 = ?


Any ideas would be welcome
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

Spatie Translatable plugin
FilamentFFilament / ❓┊help
3y ago
relationship using Spatie Translatable
FilamentFFilament / ❓┊help
3y ago
relationship with spatie translatable
FilamentFFilament / ❓┊help
3y ago
Install Spatie Translatable Plugin
FilamentFFilament / ❓┊help
3y ago