@@ -52,10 +52,17 @@ public function __construct()
5252 public function getIndex (Request $ request )
5353 {
5454 return view ('admin.servers.index ' , [
55- 'servers ' => Models \Server::select ('servers.* ' , 'nodes.name as a_nodeName ' , 'users.email as a_ownerEmail ' )
56- ->join ('nodes ' , 'servers.node ' , '= ' , 'nodes.id ' )
57- ->join ('users ' , 'servers.owner ' , '= ' , 'users.id ' )
58- ->paginate (20 ),
55+ 'servers ' => Models \Server::select (
56+ 'servers.* ' ,
57+ 'nodes.name as a_nodeName ' ,
58+ 'users.email as a_ownerEmail ' ,
59+ 'allocations.ip ' ,
60+ 'allocations.port ' ,
61+ 'allocations.ip_alias '
62+ )->join ('nodes ' , 'servers.node ' , '= ' , 'nodes.id ' )
63+ ->join ('users ' , 'servers.owner ' , '= ' , 'users.id ' )
64+ ->join ('allocations ' , 'servers.allocation ' , '= ' , 'allocations.id ' )
65+ ->paginate (20 ),
5966 ]);
6067 }
6168
@@ -76,12 +83,16 @@ public function getView(Request $request, $id)
7683 'locations.long as a_locationName ' ,
7784 'services.name as a_serviceName ' ,
7885 'services.executable as a_serviceExecutable ' ,
79- 'service_options.name as a_servceOptionName '
86+ 'service_options.name as a_servceOptionName ' ,
87+ 'allocations.ip ' ,
88+ 'allocations.port ' ,
89+ 'allocations.ip_alias '
8090 )->join ('nodes ' , 'servers.node ' , '= ' , 'nodes.id ' )
8191 ->join ('users ' , 'servers.owner ' , '= ' , 'users.id ' )
8292 ->join ('locations ' , 'nodes.location ' , '= ' , 'locations.id ' )
8393 ->join ('services ' , 'servers.service ' , '= ' , 'services.id ' )
8494 ->join ('service_options ' , 'servers.option ' , '= ' , 'service_options.id ' )
95+ ->join ('allocations ' , 'servers.allocation ' , '= ' , 'allocations.id ' )
8596 ->where ('servers.id ' , $ id )
8697 ->first ();
8798
@@ -91,8 +102,8 @@ public function getView(Request $request, $id)
91102
92103 return view ('admin.servers.view ' , [
93104 'server ' => $ server ,
94- 'assigned ' => Models \Allocation::select ( ' id ' , ' ip ' , ' port ' )-> where ('assigned_to ' , $ id )->orderBy ('ip ' , 'asc ' )->orderBy ('port ' , 'asc ' )->get (),
95- 'unassigned ' => Models \Allocation::select ( ' id ' , ' ip ' , ' port ' )-> where ('node ' , $ server ->node )->whereNull ('assigned_to ' )->orderBy ('ip ' , 'asc ' )->orderBy ('port ' , 'asc ' )->get (),
105+ 'assigned ' => Models \Allocation::where ('assigned_to ' , $ id )->orderBy ('ip ' , 'asc ' )->orderBy ('port ' , 'asc ' )->get (),
106+ 'unassigned ' => Models \Allocation::where ('node ' , $ server ->node )->whereNull ('assigned_to ' )->orderBy ('ip ' , 'asc ' )->orderBy ('port ' , 'asc ' )->get (),
96107 'startup ' => Models \ServiceVariables::select ('service_variables.* ' , 'server_variables.variable_value as a_serverValue ' )
97108 ->join ('server_variables ' , 'server_variables.variable_id ' , '= ' , 'service_variables.id ' )
98109 ->where ('service_variables.option_id ' , $ server ->option )
0 commit comments