From 565350c142b8d6c55d390be459ba79ec151b4bac Mon Sep 17 00:00:00 2001 From: hobsRKM Date: Thu, 2 May 2024 17:13:56 +0000 Subject: [PATCH] Added groups listing tab --- app/Http/Controllers/AdminController.php | 5 ++--- resources/views/partials/nav.blade.php | 2 +- resources/views/partials/scripts.blade.php | 2 +- routes/web.php | 7 +++---- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 1d78619..596de03 100755 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -362,7 +362,7 @@ public function storeGroup(StoreGroupRequest $request) $groupServer->save(); $groupAddedToServerCount[$server_id] = $server_id; } - foreach ($validatedData['permissions'] as $permissionId) { + foreach ($validatedDfata['permissions'] as $permissionId) { $permission = Permission::find($permissionId); if(empty($group->groupFlags()->where('flag', $permission->permission)->first())) { $groupFlags = new SaGroupsFlags(); @@ -451,9 +451,8 @@ public function getGroupsList(Request $request) $searchValue = $request->input('search.value'); $orderColumn = $request->input('order.0.column'); $orderDirection = $request->input('order.0.dir'); - $query = SaGroups::query(); - + DB::statement("SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));"); // Join the sa_groups_flag table to fetch flags $query->leftJoin('sa_groups_flags', 'sa_groups.id', '=', 'sa_groups_flags.group_id'); diff --git a/resources/views/partials/nav.blade.php b/resources/views/partials/nav.blade.php index bcb893d..eeb0348 100755 --- a/resources/views/partials/nav.blade.php +++ b/resources/views/partials/nav.blade.php @@ -30,7 +30,7 @@ @endif @if(PermissionsHelper::isSuperAdmin()) - + All Groups @endif @if(PermissionsHelper::isSuperAdmin()) diff --git a/resources/views/partials/scripts.blade.php b/resources/views/partials/scripts.blade.php index f2e80aa..bcd82e2 100755 --- a/resources/views/partials/scripts.blade.php +++ b/resources/views/partials/scripts.blade.php @@ -24,7 +24,7 @@ function getPlayerInfoUrl(serverId) { const adminListUrl = '{!! env('VITE_SITE_DIR') !!}/list/admins'; const bansListUrl = '{!! env('VITE_SITE_DIR') !!}/list/bans'; const playerActionUrl = '{!! env('VITE_SITE_DIR') !!}/players/action'; - const groupsListUrl = '{!! env('VITE_SITE_DIR') !!}/group/list'; + const groupsListUrl = '{!! env('VITE_SITE_DIR') !!}/list/groups'; diff --git a/routes/web.php b/routes/web.php index 9f45143..3e90f5d 100755 --- a/routes/web.php +++ b/routes/web.php @@ -37,7 +37,9 @@ Route::get('mutes', [MutesController::class, 'mutes'])->name('list.mutes');; Route::post('mutes', [MutesController::class, 'getMutesList']); Route::get('admins', [AdminController::class, 'admins'])->name('admins.list')->middleware('superadmin'); - Route::post('admins', [AdminController::class, 'getAdminsList'])->middleware('superadmin');; + Route::post('admins', [AdminController::class, 'getAdminsList'])->middleware('superadmin'); + Route::get('/groups', [AdminController::class, 'groups'])->name('groups.list')->middleware('superadmin'); + Route::post('/groups', [AdminController::class, 'getGroupsList'])->name('group.list')->middleware('superadmin'); }); Route::prefix('admin')->group(function () { @@ -54,9 +56,6 @@ Route::prefix('group')->group(function () { Route::get('/create', [AdminController::class, 'createGroup'])->name('group.create')->middleware('superadmin'); Route::post('/store', [AdminController::class, 'storeGroup'])->name('group.store')->middleware('superadmin'); - Route::get('/list', [AdminController::class, 'groups'])->name('groups.list')->middleware('superadmin'); - Route::post('/list', [AdminController::class, 'getGroupsList'])->name('group.list')->middleware('superadmin'); - }); Route::prefix('players')->group(function () { Route::post('ban', [BansController::class, 'store'])->name('ban.store')->middleware('permission.ban');