Add support for more server functionality

This commit is contained in:
Dane Everitt 2017-07-23 14:51:18 -05:00
parent acbc52506c
commit 5144e0126b
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
16 changed files with 1049 additions and 119 deletions

View file

@ -93,4 +93,36 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa
'json' => $data,
]);
}
/**
* {@inheritdoc}
*/
public function reinstall()
{
return $this->getHttpClient()->request('POST', '/server/reinstall');
}
/**
* {@inheritdoc}
*/
public function rebuild()
{
return $this->getHttpClient()->request('POST', '/server/rebuild');
}
/**
* {@inheritdoc}
*/
public function suspend()
{
return $this->getHttpClient()->request('POST', '/server/suspend');
}
/**
* {@inheritdoc}
*/
public function unsuspend()
{
return $this->getHttpClient()->request('POST', '/server/unsuspend');
}
}

View file

@ -76,4 +76,26 @@ class LocationRepository extends EloquentRepository implements LocationRepositor
return $location->delete();
}
/**
* {@inheritdoc}
*/
public function allWithDetails()
{
return $this->getBuilder()->withCount('nodes', 'servers')->get($this->getColumns());
}
/**
* {@inheritdoc}
*/
public function getWithNodes($id)
{
$instance = $this->getBuilder()->with('nodes.servers')->find($id, $this->getColumns());
if (! $instance) {
throw new RecordNotFoundException();
}
return $instance;
}
}