Skip to content

Commit 1cc9a39

Browse files
committed
bug fix for translation update
1 parent daf15f0 commit 1cc9a39

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Eloquent/Traits/Translatable.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ protected static function bootTranslatable()
4848
//Check if string was json or translation key
4949
foreach ((array) with(new self)->translatable as $item) {
5050
if ($model->{$item}) {
51-
$updated_locales = array_filter($model->{$item}, function($var) {
52-
return strlen(strip_tags(trim($var))) != 0;
53-
});
51+
$updated_locales = $model->{$item};
5452

5553
$original = $model->getOriginal($item);
5654
$original_locales = json_decode($original, true);
@@ -96,6 +94,17 @@ protected static function bootTranslatable()
9694

9795
}
9896

97+
// public function __get($key)
98+
// {
99+
// if (in_array($key, (array) $this->translatable)) {
100+
// if (array_key_exists($key, $this->attributes) || $this->hasGetMutator($key)) {
101+
// return new Translate($this->getAttributeValue($key), static::class);
102+
// }
103+
// }
104+
// // TODO: Implement __get() method.
105+
// return parent::__get($key);
106+
// }
107+
99108
/**
100109
* @param array $attributes
101110
* @param null $connection

Eloquent/Translate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Translate {
2626
*/
2727
public function __construct($string = '', $domain = '')
2828
{
29-
$decode = json_decode($string, true);
29+
$decode = is_string($string) ? json_decode($string, true) : $string;
3030
$this->translations = $decode ? $decode : [
3131
config('app.fallback_locale') => $string
3232
];

0 commit comments

Comments
 (0)