`usingLocale` method not working during `create` action
biscolab opened this issue · comments
Hi, usingLocale
method apparently is not working.
I added Spatie\Translatable\HasTranslations
trait to MyModelClass
class and:
public $translatable = [
'title',
'description',
];
Creating a new object with following code:
$item = MyModelClass::usingLocale('fr')->create([
'title' => 'French title',
]);
I expect to get the following $item->title
:
[
"fr"=> "French title"
]
but actually, the value is:
[
"en"=> "French title"
]
PHP 7.4.13
Laravel Framework 8.20.1
spatie/laravel-translatable 4.6.0
Thanks.
I can confirm that too.
I can confirm that too.
error :
ErrorException
Array to string conversion
at C:\xampp\htdocs\company\vendor\laravel\framework\src\Illuminate\Support\Str.php:509
$result = array_shift($segments);
foreach ($segments as $segment) {
$result .= (array_shift($replace) ?? $search).$segment;
}
return $result;
}
Dear contributor,
because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.
Hi @freekmurze, this issue still occurred.
Can you take a look? I tried to fix it but without success.