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