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 @@ Email Client Name Username - Servers + Servers Owned + Can Access @@ -68,7 +69,8 @@ {{ $user->email }} {{ $user->name_last }}, {{ $user->name_first }} {{ $user->username }} - {{ $user->servers_count }} + {{ $user->servers_count }} + {{ $user->subuser_of_count }} @endforeach diff --git a/resources/themes/pterodactyl/admin/users/view.blade.php b/resources/themes/pterodactyl/admin/users/view.blade.php index 6449f0dd7..287b9cc84 100644 --- a/resources/themes/pterodactyl/admin/users/view.blade.php +++ b/resources/themes/pterodactyl/admin/users/view.blade.php @@ -136,9 +136,9 @@ {{ $server->name }} @if($server->owner_id === $user->id) - @lang('strings.owner') + Owner @else - @lang('strings.subuser') + Subuser @endif {{ $server->node->name }}