fixed multi-lang problem

pull/49/head v2.2.1
A1Gard 1 month ago
parent c8b4ec1810
commit cad797d8bf

@ -680,9 +680,10 @@ function getSetting($key)
// $a = new \stdClass(); // $a = new \stdClass();
return ''; return '';
} }
if (config('app.xlang') && ($x->type == 'group' || $x->type == 'category')) {
$defLang = config('app.xlang_main'); $txtType = ['TEXT','LONGTEXT','EDITOR'];
return $x->getTranslations('value')[$defLang]; if (config('app.xlang') && !in_array($x->type, $txtType)) {
return $x->raw;
} }
return $x->value; return $x->value;
} }

@ -80,6 +80,7 @@ class SettingController extends Controller
if ($set != null && !$request->hasFile($key)) { if ($set != null && !$request->hasFile($key)) {
$set->value = validateSettingRequest($set,$val); $set->value = validateSettingRequest($set,$val);
$set->raw = validateSettingRequest($set,$val);
// need to test // need to test
if (config('app.xlang.active') && config('app.xlang.main') != 'en' && ( if (config('app.xlang.active') && config('app.xlang.main') != 'en' && (
$set->type != 'TEXT' && $set->type != 'EDITOR' && $set->type != 'LONGTEXT')){ $set->type != 'TEXT' && $set->type != 'EDITOR' && $set->type != 'LONGTEXT')){

@ -19,6 +19,7 @@ return new class extends Migration
$table->boolean('active')->default(true); $table->boolean('active')->default(true);
$table->string('key')->unique(); $table->string('key')->unique();
$table->text('value')->nullable(); $table->text('value')->nullable();
$table->text('raw')->nullable();
$table->boolean('ltr')->default(false); $table->boolean('ltr')->default(false);
$table->boolean('is_basic')->default(false); $table->boolean('is_basic')->default(false);
$table->boolean('size')->default('12'); $table->boolean('size')->default('12');

Loading…
Cancel
Save