Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Refactor Show component to use firstOrFail method when retrieving server by UUID

Andras Bacsai9044c655b884
diff --git a/app/Livewire/Server/Proxy/Show.php b/app/Livewire/Server/Proxy/Show.php
index d70e44e559..5ecb56a691 100644
--- a/app/Livewire/Server/Proxy/Show.php
+++ b/app/Livewire/Server/Proxy/Show.php
@@ -22,10 +22,7 @@ class Show extends Component
{
$this->parameters = get_route_parameters();
try {
- $this->server = Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->first();
- if (is_null($this->server)) {
- return redirect()->route('server.index');
- }
+ $this->server = Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail();
} catch (\Throwable $e) {
return handleError($e, $this);
}