forked from Alex/Pterodactyl-Panel
Correctly show number of servers a user belongs to; closes #2375
This commit is contained in:
parent
1b0a6252f1
commit
7f9b21e486
@ -84,7 +84,14 @@ class UserController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$users = QueryBuilder::for(User::query()->withCount('servers'))
|
$users = QueryBuilder::for(
|
||||||
|
User::query()->select('users.*')
|
||||||
|
->selectRaw('COUNT(subusers.id) as subuser_of_count')
|
||||||
|
->selectRaw('COUNT(servers.id) as servers_count')
|
||||||
|
->leftJoin('subusers', 'subusers.user_id', '=', 'users.id')
|
||||||
|
->leftJoin('servers', 'servers.owner_id', '=', 'users.id')
|
||||||
|
->groupBy('users.id')
|
||||||
|
)
|
||||||
->allowedFilters(['username', 'email', 'uuid'])
|
->allowedFilters(['username', 'email', 'uuid'])
|
||||||
->allowedSorts(['id', 'uuid'])
|
->allowedSorts(['id', 'uuid'])
|
||||||
->paginate(50);
|
->paginate(50);
|
||||||
|
Loading…
Reference in New Issue
Block a user