Refactor settings form handling: Removed redundant data mutation methods in CreateSetting and EditSetting pages. Updated SettingForm to use distinct fields for text and boolean values, enhancing clarity and functionality. Added new attributes in the Setting model to manage value assignments from different fields.

This commit is contained in:
Ümit Tunç
2025-10-20 15:19:34 -03:00
parent 1adc90ed59
commit 1450e8baf2
4 changed files with 32 additions and 62 deletions
+18
View File
@@ -13,6 +13,8 @@ class Setting extends Model
protected $fillable = [
'key',
'value',
'value_text',
'value_boolean',
'type',
'group',
'label',
@@ -32,6 +34,22 @@ class Setting extends Model
'deleted_at',
];
/**
* Set value from different field names
*/
public function setValueTextAttribute($value)
{
$this->attributes['value'] = $value;
}
/**
* Set value from different field names
*/
public function setValueBooleanAttribute($value)
{
$this->attributes['value'] = $value ? '1' : '0';
}
/**
* Get setting by key
*/