spatie / laravel-translatable

Making Eloquent models translatable

Home Page:https://spatie.be/docs/laravel-translatable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Last locale always added even if null

jeffreybitpuma opened this issue · comments

When you add this array as data:

[ 'en' => 'Title', 'nl' => null, 'de' => null, ]

This is saved to the DB:
{en: 'Title', de: null}

This happens because setTranslation gets the translations and filters the null values. As a result this does not happen for the last one.

I think they should all be added as null or none of the null values should be added.