Enhance settings form and model: Added support for date and datetime types in SettingForm with corresponding fields and visibility logic. Updated Setting model to handle new value types and modified migration to include date and datetime in the type enum. Enhanced localization files to support new type labels in both English and Turkish.
This commit is contained in:
@@ -16,6 +16,8 @@ class Setting extends Model
|
||||
'value_text',
|
||||
'value_boolean',
|
||||
'value_file',
|
||||
'value_date',
|
||||
'value_datetime',
|
||||
'type',
|
||||
'group',
|
||||
'label',
|
||||
@@ -59,6 +61,22 @@ class Setting extends Model
|
||||
$this->attributes['value'] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set value from different field names
|
||||
*/
|
||||
public function setValueDateAttribute($value)
|
||||
{
|
||||
$this->attributes['value'] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set value from different field names
|
||||
*/
|
||||
public function setValueDatetimeAttribute($value)
|
||||
{
|
||||
$this->attributes['value'] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get setting by key
|
||||
*/
|
||||
@@ -101,6 +119,8 @@ class Setting extends Model
|
||||
'float' => (float) $value,
|
||||
'array', 'json' => json_decode($value, true),
|
||||
'file' => $value, // File path as string
|
||||
'date' => $value, // Date as string (Y-m-d format)
|
||||
'datetime' => $value, // DateTime as string (Y-m-d H:i:s format)
|
||||
default => $value,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user