From ef1abe17b89d693deff8c7b07c261ee8075ff854 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Fri, 26 Dec 2025 13:29:53 +0100 Subject: [PATCH] refactor(redirect): replace redirect calls with redirectRoute helper for consistency --- app/Livewire/Destination/New/Docker.php | 2 +- app/Livewire/GlobalSearch.php | 4 ++-- app/Livewire/NavbarDeleteTeam.php | 2 +- app/Livewire/Project/Application/Rollback.php | 2 +- app/Livewire/Project/DeleteEnvironment.php | 2 +- app/Livewire/Project/DeleteProject.php | 2 +- app/Livewire/Project/EnvironmentEdit.php | 2 +- app/Livewire/Project/New/DockerImage.php | 2 +- app/Livewire/Project/New/EmptyProject.php | 2 +- app/Livewire/Project/Service/Database.php | 4 ++-- app/Livewire/Project/Shared/Destination.php | 2 +- app/Livewire/Project/Show.php | 4 ++-- app/Livewire/Security/PrivateKey/Create.php | 4 ++-- app/Livewire/Security/PrivateKey/Show.php | 2 +- app/Livewire/Server/Delete.php | 2 +- app/Livewire/Server/New/ByHetzner.php | 4 ++-- app/Livewire/Server/New/ByIp.php | 2 +- app/Livewire/Source/Github/Create.php | 2 +- app/Livewire/Storage/Create.php | 2 +- app/Livewire/Team/Create.php | 2 +- 20 files changed, 25 insertions(+), 25 deletions(-) diff --git a/app/Livewire/Destination/New/Docker.php b/app/Livewire/Destination/New/Docker.php index 819ac3ecd..70751fa03 100644 --- a/app/Livewire/Destination/New/Docker.php +++ b/app/Livewire/Destination/New/Docker.php @@ -95,7 +95,7 @@ public function submit() ]); } } - $this->redirect(route('destination.show', $docker->uuid)); + redirectRoute($this, 'destination.show', [$docker->uuid]); } catch (\Throwable $e) { return handleError($e, $this); } diff --git a/app/Livewire/GlobalSearch.php b/app/Livewire/GlobalSearch.php index 237076acc..5d3348692 100644 --- a/app/Livewire/GlobalSearch.php +++ b/app/Livewire/GlobalSearch.php @@ -1314,10 +1314,10 @@ private function completeResourceCreation() 'server_id' => $this->selectedServerId, ]; - $this->redirect(route('project.resource.create', [ + redirectRoute($this, 'project.resource.create', [ 'project_uuid' => $this->selectedProjectUuid, 'environment_uuid' => $this->selectedEnvironmentUuid, - ] + $queryParams)); + ] + $queryParams); } } diff --git a/app/Livewire/NavbarDeleteTeam.php b/app/Livewire/NavbarDeleteTeam.php index 9508c2adc..a8c932912 100644 --- a/app/Livewire/NavbarDeleteTeam.php +++ b/app/Livewire/NavbarDeleteTeam.php @@ -37,7 +37,7 @@ public function delete($password) refreshSession(); - return redirect()->route('team.index'); + return redirectRoute($this, 'team.index'); } public function render() diff --git a/app/Livewire/Project/Application/Rollback.php b/app/Livewire/Project/Application/Rollback.php index e53784db5..e8edf72fa 100644 --- a/app/Livewire/Project/Application/Rollback.php +++ b/app/Livewire/Project/Application/Rollback.php @@ -66,7 +66,7 @@ public function rollbackImage($commit) return; } - return redirect()->route('project.application.deployment.show', [ + return redirectRoute($this, 'project.application.deployment.show', [ 'project_uuid' => $this->parameters['project_uuid'], 'application_uuid' => $this->parameters['application_uuid'], 'deployment_uuid' => $deployment_uuid, diff --git a/app/Livewire/Project/DeleteEnvironment.php b/app/Livewire/Project/DeleteEnvironment.php index e97206081..aa6e95975 100644 --- a/app/Livewire/Project/DeleteEnvironment.php +++ b/app/Livewire/Project/DeleteEnvironment.php @@ -39,7 +39,7 @@ public function delete() if ($environment->isEmpty()) { $environment->delete(); - return redirect()->route('project.show', parameters: ['project_uuid' => $this->parameters['project_uuid']]); + return redirectRoute($this, 'project.show', ['project_uuid' => $this->parameters['project_uuid']]); } return $this->dispatch('error', "Environment {$environment->name} has defined resources, please delete them first."); diff --git a/app/Livewire/Project/DeleteProject.php b/app/Livewire/Project/DeleteProject.php index 26b35b2e7..a018046fd 100644 --- a/app/Livewire/Project/DeleteProject.php +++ b/app/Livewire/Project/DeleteProject.php @@ -35,7 +35,7 @@ public function delete() if ($project->isEmpty()) { $project->delete(); - return redirect()->route('project.index'); + return redirectRoute($this, 'project.index'); } return $this->dispatch('error', "Project {$project->name} has resources defined, please delete them first."); diff --git a/app/Livewire/Project/EnvironmentEdit.php b/app/Livewire/Project/EnvironmentEdit.php index d57be2cc8..529b9d7b1 100644 --- a/app/Livewire/Project/EnvironmentEdit.php +++ b/app/Livewire/Project/EnvironmentEdit.php @@ -63,7 +63,7 @@ public function submit() { try { $this->syncData(true); - $this->redirectRoute('project.environment.edit', [ + redirectRoute($this, 'project.environment.edit', [ 'environment_uuid' => $this->environment->uuid, 'project_uuid' => $this->project->uuid, ]); diff --git a/app/Livewire/Project/New/DockerImage.php b/app/Livewire/Project/New/DockerImage.php index 9d04ca9a5..8aff83153 100644 --- a/app/Livewire/Project/New/DockerImage.php +++ b/app/Livewire/Project/New/DockerImage.php @@ -154,7 +154,7 @@ public function submit() 'fqdn' => $fqdn, ]); - return redirect()->route('project.application.configuration', [ + return redirectRoute($this, 'project.application.configuration', [ 'application_uuid' => $application->uuid, 'environment_uuid' => $environment->uuid, 'project_uuid' => $project->uuid, diff --git a/app/Livewire/Project/New/EmptyProject.php b/app/Livewire/Project/New/EmptyProject.php index 54cfc4b4d..0360365a9 100644 --- a/app/Livewire/Project/New/EmptyProject.php +++ b/app/Livewire/Project/New/EmptyProject.php @@ -16,6 +16,6 @@ public function createEmptyProject() 'uuid' => (string) new Cuid2, ]); - return redirect()->route('project.show', ['project_uuid' => $project->uuid, 'environment_uuid' => $project->environments->first()->uuid]); + return redirectRoute($this, 'project.show', ['project_uuid' => $project->uuid, 'environment_uuid' => $project->environments->first()->uuid]); } } diff --git a/app/Livewire/Project/Service/Database.php b/app/Livewire/Project/Service/Database.php index 1e183c6bc..301c39dee 100644 --- a/app/Livewire/Project/Service/Database.php +++ b/app/Livewire/Project/Service/Database.php @@ -100,7 +100,7 @@ public function delete($password) $this->database->delete(); $this->dispatch('success', 'Database deleted.'); - return redirect()->route('project.service.configuration', $this->parameters); + return redirectRoute($this, 'project.service.configuration', $this->parameters); } catch (\Throwable $e) { return handleError($e, $this); } @@ -164,7 +164,7 @@ public function convertToApplication() $serviceDatabase->delete(); }); - return redirect()->route('project.service.configuration', $redirectParams); + return redirectRoute($this, 'project.service.configuration', $redirectParams); } catch (\Throwable $e) { return handleError($e, $this); } diff --git a/app/Livewire/Project/Shared/Destination.php b/app/Livewire/Project/Shared/Destination.php index ffd18b35c..7ab81b7d1 100644 --- a/app/Livewire/Project/Shared/Destination.php +++ b/app/Livewire/Project/Shared/Destination.php @@ -97,7 +97,7 @@ public function redeploy(int $network_id, int $server_id) return; } - return redirect()->route('project.application.deployment.show', [ + return redirectRoute($this, 'project.application.deployment.show', [ 'project_uuid' => data_get($this->resource, 'environment.project.uuid'), 'application_uuid' => data_get($this->resource, 'uuid'), 'deployment_uuid' => $deployment_uuid, diff --git a/app/Livewire/Project/Show.php b/app/Livewire/Project/Show.php index 7e828d14c..e884abb4e 100644 --- a/app/Livewire/Project/Show.php +++ b/app/Livewire/Project/Show.php @@ -48,7 +48,7 @@ public function submit() 'uuid' => (string) new Cuid2, ]); - return redirect()->route('project.resource.index', [ + return redirectRoute($this, 'project.resource.index', [ 'project_uuid' => $this->project->uuid, 'environment_uuid' => $environment->uuid, ]); @@ -59,7 +59,7 @@ public function submit() public function navigateToEnvironment($projectUuid, $environmentUuid) { - return redirect()->route('project.resource.index', [ + return redirectRoute($this, 'project.resource.index', [ 'project_uuid' => $projectUuid, 'environment_uuid' => $environmentUuid, ]); diff --git a/app/Livewire/Security/PrivateKey/Create.php b/app/Livewire/Security/PrivateKey/Create.php index 656e73958..8b7ba73dd 100644 --- a/app/Livewire/Security/PrivateKey/Create.php +++ b/app/Livewire/Security/PrivateKey/Create.php @@ -114,7 +114,7 @@ private function validatePrivateKey() private function redirectAfterCreation(PrivateKey $privateKey) { return $this->from === 'server' - ? redirect()->route('dashboard') - : redirect()->route('security.private-key.show', ['private_key_uuid' => $privateKey->uuid]); + ? redirectRoute($this, 'dashboard') + : redirectRoute($this, 'security.private-key.show', ['private_key_uuid' => $privateKey->uuid]); } } diff --git a/app/Livewire/Security/PrivateKey/Show.php b/app/Livewire/Security/PrivateKey/Show.php index c292d14a3..6be190689 100644 --- a/app/Livewire/Security/PrivateKey/Show.php +++ b/app/Livewire/Security/PrivateKey/Show.php @@ -107,7 +107,7 @@ public function delete() $this->private_key->safeDelete(); currentTeam()->privateKeys = PrivateKey::where('team_id', currentTeam()->id)->get(); - return redirect()->route('security.private-key.index'); + return redirectRoute($this, 'security.private-key.index'); } catch (\Exception $e) { $this->dispatch('error', $e->getMessage()); } catch (\Throwable $e) { diff --git a/app/Livewire/Server/Delete.php b/app/Livewire/Server/Delete.php index 27a6e7aca..e7b64b805 100644 --- a/app/Livewire/Server/Delete.php +++ b/app/Livewire/Server/Delete.php @@ -46,7 +46,7 @@ public function delete($password) $this->server->team_id ); - return redirect()->route('server.index'); + return redirectRoute($this, 'server.index'); } catch (\Throwable $e) { return handleError($e, $this); } diff --git a/app/Livewire/Server/New/ByHetzner.php b/app/Livewire/Server/New/ByHetzner.php index f7d12dbc1..f1ffa60f2 100644 --- a/app/Livewire/Server/New/ByHetzner.php +++ b/app/Livewire/Server/New/ByHetzner.php @@ -567,10 +567,10 @@ public function submit() ]); refreshSession(); - return $this->redirect(route('server.show', $server->uuid)); + return redirectRoute($this, 'server.show', [$server->uuid]); } - return redirect()->route('server.show', $server->uuid); + return redirectRoute($this, 'server.show', [$server->uuid]); } catch (\Throwable $e) { return handleError($e, $this); } diff --git a/app/Livewire/Server/New/ByIp.php b/app/Livewire/Server/New/ByIp.php index 35526d59e..1f4cdf607 100644 --- a/app/Livewire/Server/New/ByIp.php +++ b/app/Livewire/Server/New/ByIp.php @@ -128,7 +128,7 @@ public function submit() $server->settings->is_build_server = $this->is_build_server; $server->settings->save(); - return redirect()->route('server.show', $server->uuid); + return redirectRoute($this, 'server.show', [$server->uuid]); } catch (\Throwable $e) { return handleError($e, $this); } diff --git a/app/Livewire/Source/Github/Create.php b/app/Livewire/Source/Github/Create.php index 2f1482c89..4ece6a92f 100644 --- a/app/Livewire/Source/Github/Create.php +++ b/app/Livewire/Source/Github/Create.php @@ -58,7 +58,7 @@ public function createGitHubApp() session(['from' => session('from') + ['source_id' => $github_app->id]]); } - return redirect()->route('source.github.show', ['github_app_uuid' => $github_app->uuid]); + return redirectRoute($this, 'source.github.show', ['github_app_uuid' => $github_app->uuid]); } catch (\Throwable $e) { return handleError($e, $this); } diff --git a/app/Livewire/Storage/Create.php b/app/Livewire/Storage/Create.php index 9efeb948c..eda20342b 100644 --- a/app/Livewire/Storage/Create.php +++ b/app/Livewire/Storage/Create.php @@ -116,7 +116,7 @@ public function submit() $this->storage->testConnection(); $this->storage->save(); - return redirect()->route('storage.show', $this->storage->uuid); + return redirectRoute($this, 'storage.show', [$this->storage->uuid]); } catch (\Throwable $e) { $this->dispatch('error', 'Failed to create storage.', $e->getMessage()); // return handleError($e, $this); diff --git a/app/Livewire/Team/Create.php b/app/Livewire/Team/Create.php index cd15be67d..0bcfb5631 100644 --- a/app/Livewire/Team/Create.php +++ b/app/Livewire/Team/Create.php @@ -37,7 +37,7 @@ public function submit() auth()->user()->teams()->attach($team, ['role' => 'admin']); refreshSession($team); - return redirect()->route('team.index'); + return redirectRoute($this, 'team.index'); } catch (\Throwable $e) { return handleError($e, $this); }