Coerce default_task_rate to float

This commit is contained in:
David Bomba 2022-04-09 16:02:12 +10:00
parent bf03ba3780
commit 485fea03c7
3 changed files with 9 additions and 0 deletions

View File

@ -503,6 +503,7 @@ class CompanySettings extends BaseSettings
'language_id' => 'string', 'language_id' => 'string',
'show_currency_code' => 'bool', 'show_currency_code' => 'bool',
'website' => 'string', 'website' => 'string',
'default_task_rate' => 'float',
]; ];
/** /**

View File

@ -95,6 +95,10 @@ class StoreClientRequest extends Request
if (array_key_exists('settings', $input) && ! empty($input['settings'])) { if (array_key_exists('settings', $input) && ! empty($input['settings'])) {
foreach ($input['settings'] as $key => $value) { foreach ($input['settings'] as $key => $value) {
if($key == 'default_task_rate')
$value = floatval($value);
$settings->{$key} = $value; $settings->{$key} = $value;
} }
} }

View File

@ -157,6 +157,10 @@ class UpdateClientRequest extends Request
if (! array_key_exists($key, $saveable_casts)) { if (! array_key_exists($key, $saveable_casts)) {
unset($settings->{$key}); unset($settings->{$key});
} }
if($key == 'default_task_rate'){
$settings->default_task_rate = floatval($value);
}
} }
return $settings; return $settings;