server = Server::ownedByCurrentTeam()->whereUuid($server_uuid)->firstOrFail(); } catch (Throwable $e) { return handleError($e, $this); } return null; } public function delete($password) { if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation') && ! Hash::check($password, Auth::user()->password)) { $this->addError('password', 'The provided password is incorrect.'); return null; } try { $this->authorize('delete', $this->server); if ($this->server->hasDefinedResources()) { $this->dispatch('error', 'Server has defined resources. Please delete them first.'); return null; } $this->server->delete(); DeleteServer::dispatch($this->server); return redirect()->route('server.index'); } catch (Throwable $e) { return handleError($e, $this); } } public function render() { return view('livewire.server.delete'); } }