lasthourcloud/app/Http/Livewire/ForceUpgrade.php

26 lines
680 B
PHP
Raw Normal View History

2023-04-28 15:08:48 +02:00
<?php
namespace App\Http\Livewire;
2023-05-25 14:23:49 +02:00
use App\Jobs\InstanceAutoUpdateJob;
2023-05-25 22:33:47 +02:00
use App\Models\Server;
2023-04-28 15:08:48 +02:00
use Livewire\Component;
class ForceUpgrade extends Component
{
public function upgrade()
{
2023-05-25 22:33:47 +02:00
try {
$server_name = 'localhost';
if (config('app.env') === 'local') {
$server_name = 'testing-local-docker-container';
}
$server = Server::where('name', $server_name)->firstOrFail();
$this->emit('updateInitiated');
dispatch(new InstanceAutoUpdateJob(force: true, server: $server));
} catch (\Exception $e) {
return general_error_handler($e, $this);
}
2023-04-28 15:08:48 +02:00
}
}