2023-05-04 08:45:09 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Livewire\Destination;
|
|
|
|
|
|
|
|
use App\Models\StandaloneDocker;
|
|
|
|
use App\Models\SwarmDocker;
|
|
|
|
use Livewire\Component;
|
|
|
|
|
|
|
|
class Form extends Component
|
|
|
|
{
|
2023-05-04 09:14:37 +00:00
|
|
|
public mixed $destination;
|
2023-05-04 08:45:09 +00:00
|
|
|
|
|
|
|
protected $rules = [
|
|
|
|
'destination.name' => 'required',
|
|
|
|
'destination.network' => 'required',
|
|
|
|
'destination.server.ip' => 'required',
|
|
|
|
];
|
|
|
|
public function submit()
|
|
|
|
{
|
|
|
|
$this->validate();
|
|
|
|
$this->destination->save();
|
|
|
|
}
|
|
|
|
public function delete()
|
|
|
|
{
|
2023-05-09 13:10:32 +00:00
|
|
|
// instantRemoteProcess(['docker network rm -f ' . $this->destination->network], $this->destination->server);
|
2023-05-04 08:45:09 +00:00
|
|
|
$this->destination->delete();
|
|
|
|
return redirect()->route('dashboard');
|
|
|
|
}
|
|
|
|
}
|