lasthourcloud/app/Livewire/Server/Show.php

36 lines
872 B
PHP
Raw Normal View History

2023-08-29 12:36:17 +00:00
<?php
2023-12-07 18:06:32 +00:00
namespace App\Livewire\Server;
2023-08-29 12:36:17 +00:00
use App\Models\Server;
2023-08-29 13:51:30 +00:00
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
2023-08-29 12:36:17 +00:00
use Livewire\Component;
class Show extends Component
{
2023-08-29 13:51:30 +00:00
use AuthorizesRequests;
2023-08-29 12:36:17 +00:00
public ?Server $server = null;
2023-10-09 09:00:18 +00:00
public $parameters = [];
2023-08-29 12:36:17 +00:00
public function mount()
{
2023-10-09 09:00:18 +00:00
$this->parameters = get_route_parameters();
2023-08-29 13:51:30 +00:00
try {
2023-12-07 21:56:55 +00:00
$this->server = Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->first();
2023-09-14 15:45:00 +00:00
if (is_null($this->server)) {
2023-12-07 21:56:55 +00:00
return $this->redirectRoute('server.all', navigate: true);
2023-09-14 15:45:00 +00:00
}
2023-08-29 13:51:30 +00:00
} catch (\Throwable $e) {
return handleError($e, $this);
2023-08-29 13:51:30 +00:00
}
2023-08-29 12:36:17 +00:00
}
2023-10-09 09:00:18 +00:00
public function submit()
{
2023-12-07 18:06:32 +00:00
$this->dispatch('serverRefresh',false);
2023-10-09 09:00:18 +00:00
}
2023-08-29 12:36:17 +00:00
public function render()
{
return view('livewire.server.show');
}
}