fix: redirect on server not found

This commit is contained in:
Andras Bacsai 2023-09-14 17:45:00 +02:00
parent adaca4d4e3
commit d9fe16a3ee

View File

@ -13,7 +13,10 @@ class Show extends Component
public function mount()
{
try {
$this->server = Server::ownedByCurrentTeam(['name', 'description', 'ip', 'port', 'user', 'proxy'])->whereUuid(request()->server_uuid)->firstOrFail();
$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');
}
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
}