From 28f7a809a5fb7382ea88bfa48af74a3554da56a1 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 15 Jan 2022 18:10:37 +0200 Subject: [PATCH] fix: exception localization (#3850) resolves #3849 --- app/Http/Controllers/Admin/UserController.php | 2 +- app/Services/Nodes/NodeDeletionService.php | 3 ++- app/Services/Users/UserDeletionService.php | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 60a2529b9..b13ee62bf 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -127,7 +127,7 @@ class UserController extends Controller public function delete(Request $request, User $user) { if ($request->user()->id === $user->id) { - throw new DisplayException($this->translator->trans('admin/user.exceptions.user_has_servers')); + throw new DisplayException($this->translator->get('admin/user.exceptions.user_has_servers')); } $this->deletionService->handle($user); diff --git a/app/Services/Nodes/NodeDeletionService.php b/app/Services/Nodes/NodeDeletionService.php index 30483a826..e77104e09 100644 --- a/app/Services/Nodes/NodeDeletionService.php +++ b/app/Services/Nodes/NodeDeletionService.php @@ -1,4 +1,5 @@ . @@ -62,7 +63,7 @@ class NodeDeletionService $servers = $this->serverRepository->setColumns('id')->findCountWhere([['node_id', '=', $node]]); if ($servers > 0) { - throw new HasActiveServersException($this->translator->trans('exceptions.node.servers_attached')); + throw new HasActiveServersException($this->translator->get('exceptions.node.servers_attached')); } return $this->repository->delete($node); diff --git a/app/Services/Users/UserDeletionService.php b/app/Services/Users/UserDeletionService.php index 87459773e..fe02bc72c 100644 --- a/app/Services/Users/UserDeletionService.php +++ b/app/Services/Users/UserDeletionService.php @@ -1,4 +1,5 @@ . @@ -62,7 +63,7 @@ class UserDeletionService $servers = $this->serverRepository->setColumns('id')->findCountWhere([['owner_id', '=', $user]]); if ($servers > 0) { - throw new DisplayException($this->translator->trans('admin/user.exceptions.user_has_servers')); + throw new DisplayException($this->translator->get('admin/user.exceptions.user_has_servers')); } return $this->repository->delete($user);