From 5cf6b2b24156c135ab0e17ddce7eba5cd40ce84a Mon Sep 17 00:00:00 2001 From: Miguel N Date: Wed, 6 Jan 2021 01:55:22 +0000 Subject: [PATCH] Selectable game integration --- app/Http/Controllers/OptionsController.php | 25 +++++++- .../administration/settings.blade.php | 61 ++++++++++--------- routes/web.php | 3 + 3 files changed, 60 insertions(+), 29 deletions(-) diff --git a/app/Http/Controllers/OptionsController.php b/app/Http/Controllers/OptionsController.php index 9e87e2e..c5a17bb 100755 --- a/app/Http/Controllers/OptionsController.php +++ b/app/Http/Controllers/OptionsController.php @@ -46,7 +46,8 @@ class OptionsController extends Controller 'pwExpiry' => Options::getOption('password_expiry'), 'requiresPMC' => Options::getOption('requireGameLicense'), 'enforce2fa' => Options::getOption('force2fa') - ] + ], + 'currentGame' => Options::getOption('currentGame') ]); } @@ -89,4 +90,26 @@ class OptionsController extends Controller return redirect()->back(); } + + public function saveGameIntegration(Request $request) + { + $supportedGames = [ + 'RUST', + 'MINECRAFT', + 'SE', + 'GMOD' + ]; + + if (!is_null($request->gamePref) && in_array($request->gamePref, $supportedGames)) + { + Options::changeOption('currentGame', $request->gamePref); + $request->session()->flash('success', 'Updated current game.'); + + return redirect()->back(); + } + + $request->session()->flash('error', 'Unsupported game ' . $request->gamePref . '.'); + + return redirect()->back(); + } } diff --git a/resources/views/dashboard/administration/settings.blade.php b/resources/views/dashboard/administration/settings.blade.php index c4a8e08..d44732e 100755 --- a/resources/views/dashboard/administration/settings.blade.php +++ b/resources/views/dashboard/administration/settings.blade.php @@ -208,43 +208,48 @@
-
-
-
- -
+
+ @csrf + @method('PATCH') +
+
+
+ +
-
- -
+
+ +
-
- -
+
+ +
-
- +
+ +
+
-
-
+ +
diff --git a/routes/web.php b/routes/web.php index 01e0170..8a44766 100755 --- a/routes/web.php +++ b/routes/web.php @@ -209,6 +209,9 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['lo Route::post('settings/security/save', [SecuritySettingsController::class, 'save']) ->name('saveSecuritySettings'); + Route::patch('settings/game/update', [OptionsController::class, 'saveGameIntegration']) + ->name('saveGameIntegration'); + Route::post('players/ban/{user}', [BanController::class, 'insert']) ->name('banUser');