This commit is contained in:
Andras Bacsai
2023-05-04 11:14:37 +02:00
parent 32b7a1ffcd
commit 69811e26cd
5 changed files with 12 additions and 22 deletions

View File

@@ -8,23 +8,13 @@ use Livewire\Component;
class Form extends Component
{
public $destination_uuid;
public $destination;
public mixed $destination;
protected $rules = [
'destination.name' => 'required',
'destination.network' => 'required',
'destination.server.ip' => 'required',
];
public function mount()
{
$standalone = StandaloneDocker::where('uuid', $this->destination_uuid)->first();
$swarm = SwarmDocker::where('uuid', $this->destination_uuid)->first();
if (!$standalone && !$swarm) {
abort(404);
}
$this->destination = $standalone ? $standalone->load(['server']) : $swarm->load(['server']);
}
public function submit()
{
$this->validate();