Skip to content

Commit 58796e7

Browse files
committed
Fix Server model to use correct relationship when returning subusers, closes pterodactyl#1589
1 parent fe9d86b commit 58796e7

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ value when showing an error state.
1313
* Database host management will now properly display an error message to the user when there is any type of MySQL related
1414
error encountered during creation or update.
1515
* Two-factor tokens generated when a company name has a space in it will now properly be parsed on iOS authenticator devices.
16+
* Fixed 500 error when trying to request subuser's from a server in the application API.
1617

1718
### Added
1819
* Server listing view now displays the total used disk space for each server.

app/Models/Server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ public function user()
156156
/**
157157
* Gets the subusers associated with a server.
158158
*
159-
* @return \Illuminate\Database\Eloquent\Relations\HasMany
159+
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
160160
*/
161161
public function subusers()
162162
{
163-
return $this->hasMany(Subuser::class);
163+
return $this->hasManyThrough(User::class, Subuser::class, 'server_id', 'id', 'id', 'user_id');
164164
}
165165

166166
/**

0 commit comments

Comments
 (0)