From e2c7f396855db638b5da28bcaaddba55ea8fb1f8 Mon Sep 17 00:00:00 2001 From: Xinecraft Date: Thu, 14 Nov 2024 22:03:31 +0530 Subject: [PATCH] setting check fix --- app/Http/Controllers/Api/ApiBanWardenController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Api/ApiBanWardenController.php b/app/Http/Controllers/Api/ApiBanWardenController.php index 4d37d5f99..fac2c0ec5 100644 --- a/app/Http/Controllers/Api/ApiBanWardenController.php +++ b/app/Http/Controllers/Api/ApiBanWardenController.php @@ -13,6 +13,7 @@ use Illuminate\Support\Carbon; use Illuminate\Support\Facades\DB; use Illuminate\Support\Str; +use Illuminate\Support\Arr; use Cache; class ApiBanWardenController extends ApiController @@ -45,7 +46,8 @@ public function postSyncPunishments(Request $request, GeolocationService $geoloc $banwardenEnabledInConfig = config('minetrax.banwarden.enabled'); $server = Server::where('id', $request->input('data.server_id'))->firstOrFail(); - if (!$banwardenEnabledInConfig || !$server->settings['is_banwarden_enabled']) { + $banwardenEnabledForServer = Arr::get($server->settings, 'is_banwarden_enabled', false); + if (!$banwardenEnabledInConfig || !$banwardenEnabledForServer) { return $this->error(__('BanWarden is disabled globally or on this server.'), 'banwarden_disabled', 403); } @@ -156,7 +158,8 @@ public function postReportPunishment(Request $request, GeolocationService $geolo $banwardenEnabledInConfig = config('minetrax.banwarden.enabled'); $server = Server::where('id', $request->input('data.server_id'))->firstOrFail(); - if (!$banwardenEnabledInConfig || !$server->settings['is_banwarden_enabled']) { + $banwardenEnabledForServer = Arr::get($server->settings, 'is_banwarden_enabled', false); + if (!$banwardenEnabledInConfig || !$banwardenEnabledForServer) { return $this->error(__('BanWarden is disabled globally or on this server.'), 'banwarden_disabled', 403); }