Skip to content

Commit

Permalink
Unban/unmute ,migrate fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hobsRKM committed May 2, 2024
1 parent 3716ef7 commit b8d9bc1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
16 changes: 16 additions & 0 deletions app/Http/Controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ public function store(StoreAdminRequest $request)
$saAdmin->group_id = $groupId;
$saAdmin->created = now();
$saAdmin->save();

$adminFlag = new SaAdminsFlags();
$adminFlag->admin_id = $saAdmin->id;
$adminFlag->flag = SaGroups::find($groupId)->value('name');
$adminFlag->save();

$adminAddedToServerCount[$server_id] = $server_id;
}
}
Expand Down Expand Up @@ -231,6 +237,11 @@ public function updateAdmin(Request $request, $player_steam)
$saAdmin->group_id = $groupId;
$saAdmin->created = now();
$saAdmin->save();

$adminFlag = new SaAdminsFlags();
$adminFlag->admin_id = $saAdmin->id;
$adminFlag->flag = SaGroups::find($groupId)->value('name');
$adminFlag->save();
}
}
} else {
Expand Down Expand Up @@ -384,6 +395,11 @@ public function updateAdminGroup(Request $request, $player_steam)
$saAdmin->group_id = $groupId;
$saAdmin->created = now();
$saAdmin->save();

$adminFlag = new SaAdminsFlags();
$adminFlag->admin_id = $saAdmin->id;
$adminFlag->flag = SaGroups::find($groupId)->value('name');
$adminFlag->save();
}

// Handle groups to delete
Expand Down
8 changes: 6 additions & 2 deletions app/Http/Controllers/BansController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public function getBansList(Request $request)
$editAction = "<a href='$siteDir/ban/edit/{$ban->id}' class='btn btn-info btn-sm'><i class='fa fa-edit'></i></a>";
}
$unbanAction = '';
if(empty($ban->player_steamid))
$ban->player_steamid = $ban->id;
if(PermissionsHelper::hasUnBanPermission($ban->server_id) && $ban->status == 'ACTIVE') {
$unbanAction = "<button class='btn btn-success btn-sm unban-btn' data-player-steamid='{$ban->player_steamid}'><i class='fas fa-ban'></i></button>";
}
Expand Down Expand Up @@ -89,9 +91,11 @@ public function getBansList(Request $request)
return response()->json($response);
}

public function unban(Request $request, $playerSteamid)
public function unban(Request $request, $dataId)
{
$bans = SaBan::where('player_steamid', $playerSteamid)->get();
$bans = SaBan::where('player_steamid', $dataId)
->orWhere('id', $dataId)
->get();

try {
// Start a database transaction
Expand Down
8 changes: 6 additions & 2 deletions app/Http/Controllers/MutesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public function getMutesList(Request $request)
$editAction = "<a href='$siteDir/mute/edit/{$mute->id}' class='btn btn-info btn-sm'><i class='fa fa-edit'></i></a>";
}
$unmuteAction = '';
if(empty($mute->player_steamid))
$mute->player_steamid = $mute->id;
if(PermissionsHelper::hasUnMutePermission($mute->server_id) && $mute->status == 'ACTIVE') {
$unmuteAction = "<button class='btn btn-success btn-sm unmute-btn' data-player-steamid='{$mute->player_steamid}'><i class='fas fa-ban'></i></button>";
}
Expand Down Expand Up @@ -89,9 +91,11 @@ public function getMutesList(Request $request)
return response()->json($response);
}

public function unmute(Request $request, $playerSteamid)
public function unmute(Request $request, $dataId)
{
$mutes = SaMute::where('player_steamid', $playerSteamid)->get();
$mutes = SaMute::where('player_steamid', $dataId)
->orWhere('id', $dataId)
->get();

try {
// Start a database transaction
Expand Down

0 comments on commit b8d9bc1

Please sign in to comment.