FilamentF
Filament14mo ago
tuseto

Filament repeater translations messed up structure on save

When create repeater first row for the model on bg language the result in the db is:
{"bg":[{"name":"first","slug":"first"}],"de":""}
Adding second row for same language is okay and the result is:
{"bg":[{"name":"first","slug":"first"},{"name":"second","slug":"second"}],"de":""}

Then when change the language to en and add the first row in the repeater everything breaks:
{"bg":{"d6073341-870a-43f3-bb83-8c49d4df16bf":{"name":"first","slug":"first"},"38b95945-88e1-462b-9e8c-469766af5baf":{"name":"second","slug":"second"}},"en":[{"name":"english_first","slug":"english_first"}]}

Composer.lock
filament/filament: version: v3.2.121
filament/spatie-laravel-translatable-plugin: v3.3.0
repositories: https://github.com/lara-zeus/translatable
(I am using lara-zeus fork of filament-translatable, because as I remember I have problems with file upload for different languages on the original filament-translatable repo)

I have a repeater:
Repeater::make('files')
  ->schema([
      TextInput::make('name')->required(),
      TextInput::make('slug')->required(),
      // FileUpload::make('file'),
  ])
  ->columns(2),

files is in my model $translatable fields
files is cast as array 'files' => 'array',

All model translations works as expected but repeater not.
GitHub
A Fork of the Filament spatie/laravel-translatable Plugin - lara-zeus/translatable
Was this page helpful?