Fix Server model to use correct relationship when returning subusers, closes #1589

This commit is contained in:
Dane Everitt 2019-08-03 12:56:32 -07:00
parent fe9d86b66b
commit 58796e7441
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
2 changed files with 3 additions and 2 deletions

View File

@ -13,6 +13,7 @@ value when showing an error state.
* Database host management will now properly display an error message to the user when there is any type of MySQL related * Database host management will now properly display an error message to the user when there is any type of MySQL related
error encountered during creation or update. error encountered during creation or update.
* Two-factor tokens generated when a company name has a space in it will now properly be parsed on iOS authenticator devices. * Two-factor tokens generated when a company name has a space in it will now properly be parsed on iOS authenticator devices.
* Fixed 500 error when trying to request subuser's from a server in the application API.
### Added ### Added
* Server listing view now displays the total used disk space for each server. * Server listing view now displays the total used disk space for each server.

View File

@ -156,11 +156,11 @@ class Server extends Model implements CleansAttributes, ValidableContract
/** /**
* Gets the subusers associated with a server. * Gets the subusers associated with a server.
* *
* @return \Illuminate\Database\Eloquent\Relations\HasMany * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
*/ */
public function subusers() public function subusers()
{ {
return $this->hasMany(Subuser::class); return $this->hasManyThrough(User::class, Subuser::class, 'server_id', 'id', 'id', 'user_id');
} }
/** /**