Change order that allocations are loaded in on the allocation listing

This commit is contained in:
Dane Everitt 2018-01-08 22:21:35 -06:00
parent 22511c8e24
commit 0acc260b81
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 3 additions and 2 deletions

View file

@ -106,7 +106,7 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa
public function loadNodeAllocations(Node $node, bool $refresh = false): Node
{
$node->setRelation('allocations',
$node->allocations()->orderBy('ip', 'asc')->orderBy('port', 'asc')->with('server')->paginate(50)
$node->allocations()->orderByRaw('server_id IS NOT NULL DESC, server_id IS NULL')->orderByRaw('INET_ATON(ip) ASC')->orderBy('port', 'asc')->with('server')->paginate(50)
);
return $node;