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:
@@ -23,24 +23,4 @@ class CreateSetting extends CreateRecord
|
||||
{
|
||||
return __('settings.created_successfully');
|
||||
}
|
||||
|
||||
protected function mutateFormDataBeforeSave(array $data): array
|
||||
{
|
||||
// Boolean değerleri string'e çevir
|
||||
if (isset($data['type']) && $data['type'] === 'boolean') {
|
||||
$data['value'] = $data['value'] ? '1' : '0';
|
||||
}
|
||||
|
||||
// Integer değerleri string'e çevir
|
||||
if (isset($data['type']) && $data['type'] === 'integer') {
|
||||
$data['value'] = (string) $data['value'];
|
||||
}
|
||||
|
||||
// Float değerleri string'e çevir
|
||||
if (isset($data['type']) && $data['type'] === 'float') {
|
||||
$data['value'] = (string) $data['value'];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user