coolify/app/Livewire/Server/Show.php

36 lines
917 B
PHP
Raw Normal View History

2023-08-29 14:36:17 +02:00
<?php
2023-12-07 19:06:32 +01:00
namespace App\Livewire\Server;
2023-08-29 14:36:17 +02:00
use App\Models\Server;
2023-08-29 15:51:30 +02:00
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
2023-08-29 14:36:17 +02:00
use Livewire\Component;
class Show extends Component
{
2023-08-29 15:51:30 +02:00
use AuthorizesRequests;
2023-08-29 14:36:17 +02:00
public ?Server $server = null;
2023-10-09 11:00:18 +02:00
public $parameters = [];
protected $listeners = ['serverInstalled' => '$refresh'];
2023-08-29 14:36:17 +02:00
public function mount()
{
2023-10-09 11:00:18 +02:00
$this->parameters = get_route_parameters();
2023-08-29 15:51:30 +02:00
try {
2023-12-07 22:56:55 +01:00
$this->server = Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->first();
2023-09-14 17:45:00 +02:00
if (is_null($this->server)) {
2024-01-07 16:23:41 +01:00
return redirect()->route('server.index');
2023-09-14 17:45:00 +02:00
}
2023-08-29 15:51:30 +02:00
} catch (\Throwable $e) {
return handleError($e, $this);
2023-08-29 15:51:30 +02:00
}
2023-08-29 14:36:17 +02:00
}
2023-10-09 11:00:18 +02:00
public function submit()
{
2024-01-31 08:56:49 +01:00
$this->dispatch('serverRefresh', false);
2023-10-09 11:00:18 +02:00
}
2023-08-29 14:36:17 +02:00
public function render()
{
return view('livewire.server.show');
}
}