Add file type support in settings: Updated SettingForm to include a file upload field for settings, modified the Setting model to handle file values, and added a migration to accommodate the new file type. Enhanced localization files to support the new file type label in both English and Turkish.
This commit is contained in:
@@ -15,6 +15,7 @@ class Setting extends Model
|
||||
'value',
|
||||
'value_text',
|
||||
'value_boolean',
|
||||
'value_file',
|
||||
'type',
|
||||
'group',
|
||||
'label',
|
||||
@@ -50,6 +51,14 @@ class Setting extends Model
|
||||
$this->attributes['value'] = $value ? '1' : '0';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set value from different field names
|
||||
*/
|
||||
public function setValueFileAttribute($value)
|
||||
{
|
||||
$this->attributes['value'] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get setting by key
|
||||
*/
|
||||
@@ -91,6 +100,7 @@ class Setting extends Model
|
||||
'integer' => (int) $value,
|
||||
'float' => (float) $value,
|
||||
'array', 'json' => json_decode($value, true),
|
||||
'file' => $value, // File path as string
|
||||
default => $value,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user