refactor: remove diagnostic and translation scripts and implement automatic cache clearing for settings in the model.

This commit is contained in:
Ümit Tunç
2026-05-20 00:06:01 +03:00
parent 19c9202fc1
commit 575fdad12c
15 changed files with 18 additions and 3446 deletions
@@ -24,7 +24,12 @@ class EditSetting extends EditRecord
if (isset($data['type'])) {
$type = $data['type'];
$virtualField = 'value_' . $type;
// Map the setting type to the form field name
$virtualField = match ($type) {
'string', 'text', 'json', 'integer', 'float' => 'value_text',
default => 'value_' . $type,
};
try {
// Model accessor'ını kullanarak değeri al
@@ -115,7 +115,7 @@ class SettingForm
->label(__('settings.value'))
->helperText(__('settings.value_helper'))
->required()
->visible(fn (Get $get) => in_array($get('type'), ['string', 'text', 'json']) && !in_array($get('key'), ['default_header', 'default_footer']))
->visible(fn (Get $get) => in_array($get('type'), ['string', 'text', 'json', 'integer', 'float']) && !in_array($get('key'), ['default_header', 'default_footer']))
->rows(fn (Get $get) => $get('type') === 'text' ? 5 : 3)
->columnSpanFull(),
+11
View File
@@ -10,6 +10,17 @@ class Setting extends Model
{
use HasFactory, SoftDeletes;
protected static function booted()
{
static::saved(function ($setting) {
\Illuminate\Support\Facades\Cache::forget("app_setting_{$setting->key}");
});
static::deleted(function ($setting) {
\Illuminate\Support\Facades\Cache::forget("app_setting_{$setting->key}");
});
}
protected $fillable = [
'key',
'value',