From d9fe16a3ee021a60c0cdea85cc966ec239a1a88c Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 14 Sep 2023 17:45:00 +0200 Subject: [PATCH] fix: redirect on server not found --- app/Http/Livewire/Server/Show.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Livewire/Server/Show.php b/app/Http/Livewire/Server/Show.php index 75053cc1a..025fc82ff 100644 --- a/app/Http/Livewire/Server/Show.php +++ b/app/Http/Livewire/Server/Show.php @@ -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); }