adds support for viewing server stats from 'Your Servers' page

http://s3.pterodactyl.io/bnSTK.png
This commit is contained in:
Dane Everitt 2016-01-05 01:15:23 -05:00
parent 69f0340c48
commit 09d28bf145
5 changed files with 65 additions and 38 deletions

View file

@ -79,10 +79,10 @@ class Server extends Model
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getUserServers()
public static function getUserServers($paginate = null)
{
$query = self::select('servers.*', 'nodes.name as nodeName', 'locations.long as location')
$query = self::select('servers.*', 'nodes.name as nodeName', 'locations.short as a_locationShort')
->join('nodes', 'servers.node', '=', 'nodes.id')
->join('locations', 'nodes.location', '=', 'locations.id')
->where('active', 1);
@ -91,6 +91,10 @@ class Server extends Model
$query->whereIn('servers.id', Subuser::accessServers());
}
if (is_numeric($paginate)) {
return $query->paginate($paginate);
}
return $query->get();
}