Closed salipro4ever closed 6 years ago
This puts all data on the models during create()
https://github.com/dimsav/laravel-translatable/blob/5f19c5b9253ea49baa935135ae2ffd37f81bc5d4/src/Translatable/Translatable.php#L280-L296
So you can use one of the following ways:
MyModel::create([
'en' => ['name' => 'Greece'],
'fr' => ['name' => 'Grèce'],
]);
MyModel::create([
'name:en' => 'Greece',
'name:fr' => 'Grèce',
]);
$model = new MyModel();
$model->setDefaultLocale('jp')->fill($data)->save();
$model->setDefaultLocale(null);
App::setLocale('jp');
MyModel::create([...])
App::setLocale('en');
In case, it is a instance, i can assign a language to save:
When use mass create() method, is there any way to do the same thing? Example:
If use
Filling multiple translations
doc, i must change format of data. I dont want that.My temporary solution: