lasthourcloud/app/Http/Livewire/Destination/Show.php
Andras Bacsai f828cd813b fix
2023-06-15 15:38:15 +02:00

25 lines
867 B
PHP

<?php
namespace App\Http\Livewire\Destination;
use App\Models\Server;
use Illuminate\Support\Collection;
use Livewire\Component;
class Show extends Component
{
public Server $server;
public Collection|array $networks = [];
public function scan()
{
$alreadyAddedNetworks = $this->server->standaloneDockers;
ray($alreadyAddedNetworks);
$networks = instant_remote_process(['docker network ls --format "{{json .}}"'], $this->server, false);
$this->networks = format_docker_command_output_to_json($networks)->filter(function ($network) {
return $network['Name'] !== 'bridge' && $network['Name'] !== 'host' && $network['Name'] !== 'none';
})->filter(function ($network) use ($alreadyAddedNetworks) {
return !$alreadyAddedNetworks->contains('network', $network['Name']);
});
}
}