coolify/app/Http/Livewire/Project/Application/Danger.php

29 lines
815 B
PHP
Raw Normal View History

2023-05-18 13:26:35 +02:00
<?php
namespace App\Http\Livewire\Project\Application;
2023-05-22 12:47:15 +02:00
use App\Models\Application;
2023-05-18 13:26:35 +02:00
use Livewire\Component;
class Danger extends Component
{
2023-05-22 12:47:15 +02:00
public Application $application;
public array $parameters;
public function mount()
{
2023-05-24 14:26:50 +02:00
$this->parameters = get_parameters();
2023-05-22 12:47:15 +02:00
}
public function delete()
{
$destination = $this->application->destination->getMorphClass()::where('id', $this->application->destination->id)->first();
2023-05-24 15:25:08 +02:00
instant_remote_process(["docker rm -f {$this->application->uuid}"], $destination->server);
2023-05-22 12:47:15 +02:00
$this->application->delete();
return redirect()->route('project.resources', [
'project_uuid' => $this->parameters['project_uuid'],
'environment_name' => $this->parameters['environment_name']
]);
}
2023-05-18 13:26:35 +02:00
}