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 initialize server and remove unused code

Andras Bacsaidf4e4c2b4ed7
diff --git a/app/Livewire/Server/Show.php b/app/Livewire/Server/Show.php
index a5e94a19a1..0e07ec0a10 100644
--- a/app/Livewire/Server/Show.php
+++ b/app/Livewire/Server/Show.php
@@ -2,28 +2,22 @@
namespace App\Livewire\Server;
+use App\Livewire\BaseComponent;
use App\Models\Server;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
-use Livewire\Component;
-class Show extends Component
+class Show extends BaseComponent
{
use AuthorizesRequests;
- public ?Server $server = null;
-
- public $parameters = [];
+ public Server $server;
protected $listeners = ['refreshServerShow'];
public function mount()
{
- $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);
}