fixed multi-lang problem

pull/49/head v2.2.1
A1Gard 2 months ago
parent c8b4ec1810
commit cad797d8bf

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

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

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

Loading…
Cancel
Save