| @@ 54-63 (lines=10) @@ | ||
| 51 | )->join('services', 'services.id', '=', 'service_options.parent_service')->get(); |
|
| 52 | ||
| 53 | $array = []; |
|
| 54 | foreach ($options as &$option) { |
|
| 55 | if (! array_key_exists($option->p_service, $array)) { |
|
| 56 | $array[$option->p_service] = []; |
|
| 57 | } |
|
| 58 | ||
| 59 | $array[$option->p_service] = array_merge($array[$option->p_service], [[ |
|
| 60 | 'id' => $option->id, |
|
| 61 | 'name' => $option->name, |
|
| 62 | ]]); |
|
| 63 | } |
|
| 64 | ||
| 65 | return $array; |
|
| 66 | } |
|
| @@ 220-226 (lines=7) @@ | ||
| 217 | $ips = Models\Allocation::where('node', $request->input('node'))->whereNull('assigned_to')->get(); |
|
| 218 | $listing = []; |
|
| 219 | ||
| 220 | foreach ($ips as &$ip) { |
|
| 221 | if (array_key_exists($ip->ip, $listing)) { |
|
| 222 | $listing[$ip->ip] = array_merge($listing[$ip->ip], [$ip->port]); |
|
| 223 | } else { |
|
| 224 | $listing[$ip->ip] = [$ip->port]; |
|
| 225 | } |
|
| 226 | } |
|
| 227 | ||
| 228 | return response()->json($listing); |
|
| 229 | } |
|