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;
|
2024-10-17 20:00:27 +00:00
|
|
|
use Livewire\Component;
|
2023-08-29 12:36:17 +00:00
|
|
|
|
2024-10-17 20:00:27 +00:00
|
|
|
class Show extends Component
|
2023-08-29 12:36:17 +00:00
|
|
|
{
|
2023-08-29 13:51:30 +00:00
|
|
|
use AuthorizesRequests;
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2024-10-17 19:48:43 +00:00
|
|
|
public Server $server;
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2024-10-17 20:00:27 +00:00
|
|
|
public array $parameters;
|
|
|
|
|
|
2024-09-12 10:34:09 +00:00
|
|
|
protected $listeners = ['refreshServerShow'];
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2023-08-29 12:36:17 +00:00
|
|
|
public function mount()
|
|
|
|
|
{
|
2023-08-29 13:51:30 +00:00
|
|
|
try {
|
2024-10-17 19:48:43 +00:00
|
|
|
$this->server = Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail();
|
2024-10-17 20:00:27 +00:00
|
|
|
$this->parameters = get_route_parameters();
|
2023-08-29 13:51:30 +00:00
|
|
|
} catch (\Throwable $e) {
|
2023-09-15 13:34:25 +00:00
|
|
|
return handleError($e, $this);
|
2023-08-29 13:51:30 +00:00
|
|
|
}
|
2023-08-29 12:36:17 +00:00
|
|
|
}
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2024-09-12 10:34:09 +00:00
|
|
|
public function refreshServerShow()
|
|
|
|
|
{
|
|
|
|
|
$this->server->refresh();
|
|
|
|
|
$this->dispatch('$refresh');
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-09 09:00:18 +00:00
|
|
|
public function submit()
|
|
|
|
|
{
|
2024-01-31 07:56:49 +00:00
|
|
|
$this->dispatch('serverRefresh', false);
|
2023-10-09 09:00:18 +00:00
|
|
|
}
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2023-08-29 12:36:17 +00:00
|
|
|
public function render()
|
|
|
|
|
{
|
|
|
|
|
return view('livewire.server.show');
|
|
|
|
|
}
|
|
|
|
|
}
|