More improvements to add server page.

This commit is contained in:
Dane Everitt 2017-02-23 22:52:05 -05:00
parent 8f96b35db1
commit 58999913ba
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 164 additions and 60 deletions

View file

@ -120,13 +120,13 @@ class ServersController extends Controller
$nodes = Models\Node::with('allocations')->where('location_id', $request->input('location'))->get();
return $nodes->map(function ($item) {
$filtered = $item->allocations->map(function($map) {
return collect($map)->only(['ip', 'port']);
return collect($map)->only(['id', 'ip', 'port']);
});
$item->ports = $filtered->unique('ip')->map(function ($map) use ($item) {
$item->ports = $filtered->map(function ($map) use ($item) {
return [
'ip' => $map['ip'],
'ports' => $item->allocations->where('ip', $map['ip'])->pluck('port')->all(),
'id' => $map['id'],
'text' => $map['ip'] . ':' . $map['port'],
];
})->values();