Skip to content

Commit

Permalink
fix for json column type
Browse files Browse the repository at this point in the history
  • Loading branch information
grinry authored Feb 15, 2017
1 parent 9f2ffb3 commit 2f0710d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Eloquent/Traits/Translatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected static function bootTranslatable()
$translations = array_filter($model->{$item}, function($var) {
return strlen(strip_tags(trim($var))) != 0;
});
$model->{$item} = count($translations) ? json_encode($translations) : '';
$model->{$item} = count($translations) ? json_encode($translations) : '{}';
} elseif (is_string($model->{$item}) && !is_array(json_decode($model->{$item}, true))) {
$model->{$item} = json_encode([config('app.locale') => $model->{$item}]);
}
Expand Down Expand Up @@ -82,7 +82,7 @@ protected static function bootTranslatable()
$translations = array_filter($original_locales, function($var) {
return strlen(strip_tags(trim($var))) != 0;
});
$model->{$item} = count($translations) ? json_encode($translations) : '';
$model->{$item} = count($translations) ? json_encode($translations) : '{}';
} else {
//TODO: update locales in translation model
//
Expand Down

0 comments on commit 2f0710d

Please sign in to comment.