|
@@ -6,7 +6,7 @@ use App\Models\Settings;
|
|
|
use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
use Illuminate\Support\Facades\Config;
|
|
|
-use Illuminate\Support\Facades\Session;
|
|
|
+use Illuminate\Support\Facades\Validator;
|
|
|
|
|
|
class Misc
|
|
|
{
|
|
@@ -19,21 +19,33 @@ class Misc
|
|
|
|
|
|
public function updateSettings(Request $request)
|
|
|
{
|
|
|
- $request->validate([
|
|
|
+ $validator = Validator::make($request->all(), [
|
|
|
'icon' => 'nullable|max:10000|mimes:jpg,png,jpeg',
|
|
|
'favicon' => 'nullable|max:10000|mimes:ico',
|
|
|
+ 'discord-bot-token' => 'nullable|string',
|
|
|
+ 'discord-client-id' => 'nullable|string',
|
|
|
+ 'discord-client-secret' => 'nullable|string',
|
|
|
+ 'discord-guild-id' => 'nullable|string',
|
|
|
+ 'discord-invite-url' => 'nullable|string',
|
|
|
+ 'discord-role-id' => 'nullable|string',
|
|
|
+ 'recaptcha-site-key' => 'nullable|string',
|
|
|
+ 'recaptcha-secret-key' => 'nullable|string',
|
|
|
+ 'enable-recaptcha' => 'nullable|boolean',
|
|
|
]);
|
|
|
|
|
|
+ if ($validator->fails()) {
|
|
|
+ return redirect(route('admin.settings.index') . '#misc')->with('error', __('Misc settings have not been updated!'))->withErrors($validator)
|
|
|
+ ->withInput();
|
|
|
+ }
|
|
|
+
|
|
|
if ($request->hasFile('icon')) {
|
|
|
$request->file('icon')->storeAs('public', 'icon.png');
|
|
|
}
|
|
|
-
|
|
|
if ($request->hasFile('favicon')) {
|
|
|
$request->file('favicon')->storeAs('public', 'favicon.ico');
|
|
|
}
|
|
|
|
|
|
$values = [
|
|
|
- //SETTINGS::VALUE => REQUEST-VALUE (coming from the html-form)
|
|
|
"SETTINGS::DISCORD:BOT_TOKEN" => "discord-bot-token",
|
|
|
"SETTINGS::DISCORD:CLIENT_ID" => "discord-client-id",
|
|
|
"SETTINGS::DISCORD:CLIENT_SECRET" => "discord-client-secret",
|