diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 14a77e2da..c9d7a4725 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -44,7 +44,7 @@ class UserController extends Controller */ public function index(Request $request) { - $users = User::withCount('servers'); + $users = User::withCount('servers', 'subuserOf'); if (! is_null($request->input('query'))) { $users->search($request->input('query')); diff --git a/app/Models/User.php b/app/Models/User.php index 649af11a7..b159da9ad 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -239,4 +239,14 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac { return $this->hasMany(Server::class, 'owner_id'); } + + /** + * Return all servers that user is listed as a subuser of directly. + * + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + public function subuserOf() + { + return $this->hasMany(Subuser::class); + } } diff --git a/resources/themes/pterodactyl/admin/users/index.blade.php b/resources/themes/pterodactyl/admin/users/index.blade.php index 9599664a8..761f267a0 100644 --- a/resources/themes/pterodactyl/admin/users/index.blade.php +++ b/resources/themes/pterodactyl/admin/users/index.blade.php @@ -57,7 +57,8 @@