validate([ 'decimalFormat' => 'required|string|in:0,1,2,3,4', 'defaultCurrency' => 'required|string|exists:currencies,code', 'decimalSeparator' => ['required', 'string', Rule::in(['.', ','])], 'thousandsSeparator' => 'required|string', 'floatNumber' => 'required|boolean', 'currencySymbolSpace' => 'required|boolean', 'currencySymbolPosition' => 'required|string|in:before,after', ]); // Update settings using helper function foreach ($validated as $key => $value) { updateSetting($key, $value); } return redirect()->back()->with('success', __('Currency settings updated successfully.')); } catch (\Exception $e) { return redirect()->back()->with('error', __('Failed to update currency settings: :error', ['error' => $e->getMessage()])); } } }