with('location')->get()->map(function (Node $node) { return [ 'id' => $node->id, 'uuid' => $node->uuid, 'name' => $node->name, 'location' => $node->location->short, 'host' => $node->getConnectionAddress(), ]; }); if ($this->option('format') === 'json') { $this->output->write($nodes->toJson(JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); } else { $this->table(['ID', 'UUID', 'Name', 'Location', 'Host'], $nodes->toArray()); } $this->output->newLine(); return 0; } }