2023-08-29 12:36:17 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Livewire\Server;
|
|
|
|
|
|
|
|
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-09-14 15:45:00 +00:00
|
|
|
$this->server = Server::ownedByCurrentTeam(['name', 'description', 'ip', 'port', 'user', 'proxy'])->whereUuid(request()->server_uuid)->first();
|
|
|
|
if (is_null($this->server)) {
|
|
|
|
return redirect()->route('server.all');
|
|
|
|
}
|
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
|
|
|
}
|
2023-10-09 09:00:18 +00:00
|
|
|
public function submit()
|
|
|
|
{
|
|
|
|
$this->emit('serverRefresh');
|
|
|
|
}
|
2023-08-29 12:36:17 +00:00
|
|
|
public function render()
|
|
|
|
{
|
|
|
|
return view('livewire.server.show');
|
|
|
|
}
|
|
|
|
}
|