вкладка для ботов в админке

This commit is contained in:
2026-03-14 02:06:27 +04:00
parent 5a346a312d
commit d4880d2f05
8 changed files with 170 additions and 20 deletions
@@ -20,9 +20,29 @@ class AccountController extends Controller
): View
{
$search = trim((string) $request->query('search', ''));
$searchTerm = $search !== '' ? $search : null;
$activeTab = (string) $request->query('tab', AzerothCoreAccountService::ACCOUNT_TAB_PLAYERS);
if (! in_array($activeTab, [AzerothCoreAccountService::ACCOUNT_TAB_PLAYERS, AzerothCoreAccountService::ACCOUNT_TAB_BOTS], true)) {
$activeTab = AzerothCoreAccountService::ACCOUNT_TAB_PLAYERS;
}
$accountStats = $accounts->accountTypeStats($searchTerm);
return view('admin.accounts.index', [
'accounts' => $accounts->listAccounts($search !== '' ? $search : null),
'accounts' => $accounts->listAccounts($searchTerm, $activeTab),
'accountStats' => $accountStats,
'accountTabs' => [
AzerothCoreAccountService::ACCOUNT_TAB_PLAYERS => [
'label' => 'Игроки',
'count' => $accountStats[AzerothCoreAccountService::ACCOUNT_TAB_PLAYERS] ?? 0,
],
AzerothCoreAccountService::ACCOUNT_TAB_BOTS => [
'label' => 'Боты',
'count' => $accountStats[AzerothCoreAccountService::ACCOUNT_TAB_BOTS] ?? 0,
],
],
'activeTab' => $activeTab,
'inviteCodes' => $inviteCodes->latest(),
'inviteStats' => $inviteCodes->stats(),
'search' => $search,