Spatie Translatable Plugin and relationship fieldset
My
Page
model has a MorphOne
relationship to the Seo
model. The Seo
model has columns like title and description.
In my PageResource
i have a fieldset for the Seo
relationship:
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'];
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
Now all of a sudden the seo
isn't stored as a relationship but as a column on the page model.
the raw query is:
update
pages set
title = ?,
seo = ?,
pages.
updated_at = ? where
id = ?
Any ideas would be welcome3 Replies
Did you manage to solve this I am also getting this problem ?
You can’t define Seo as translatable on the parent model. You need to set it to have its own translations on the Seo model. If I’m understanding your setup correctly.
Im having the same issue, it worked before but not anymore