fix: 🥅 fixed validation -> checkboxes return "true" as string

This commit is contained in:
IceToast 2022-01-15 01:48:40 +01:00
parent 7ca6438f35
commit 010ddfe3b6
3 changed files with 6 additions and 9 deletions

View file

@ -21,7 +21,7 @@ class Language
{
$validator = Validator::make($request->all(), [
'autotranslate' => 'string',
'canClientChangeLanguage' => 'boolean',
'canClientChangeLanguage' => 'string',
'defaultLanguage' => 'required|string',
'languages' => 'required|array',
'languages.*' => 'required|string',

View file

@ -29,7 +29,6 @@ class Payments
"stripe-methods" => "nullable|string",
"sales-tax" => "nullable|numeric",
]);
if ($validator->fails()) {
return redirect(route('admin.settings.index') . '#payment')->with('error', __('Payment settings have not been updated!'))->withErrors($validator)
->withInput();
@ -46,7 +45,7 @@ class Payments
"SETTINGS::PAYMENTS:STRIPE:TEST_SECRET" => "stripe-test-secret",
"SETTINGS::PAYMENTS:STRIPE:ENDPOINT_TEST_SECRET" => "stripe-endpoint-test-secret",
"SETTINGS::PAYMENTS:STRIPE:METHODS" => "stripe-methods",
"SETTINGS::PAYMENTS:SALES_TAX" => "sales_tax"
"SETTINGS::PAYMENTS:SALES_TAX" => "sales-tax"
];
@ -57,7 +56,6 @@ class Payments
Cache::forget("setting" . ':' . $key);
}
return redirect(route('admin.settings.index') . '#payment')->with('success', __('Payment settings updated!'));
}
}

View file

@ -21,12 +21,12 @@ class System
public function updateSettings(Request $request)
{
$validator = Validator::make($request->all(), [
"register-ip-check" => "boolean",
"server-create-charge-first-hour" => "boolean",
"register-ip-check" => "string",
"server-create-charge-first-hour" => "string",
"credits-display-name" => "required|string",
"allocation-limit" => "required|min:0|integer",
"force-email-verification" => "boolean",
"force-discord-verification" => "boolean",
"force-email-verification" => "string",
"force-discord-verification" => "string",
"initial-credits" => "required|min:0|integer",
"initial-server-limit" => "required|min:0|integer",
"credits-reward-amount-discord" => "required|min:0|integer",
@ -35,7 +35,6 @@ class System
"server-limit-email" => "required|min:0|integer",
]);
if ($validator->fails()) {
return redirect(route('admin.settings.index') . '#system')->with('error', __('System settings have not been updated!'))->withErrors($validator)
->withInput();