From 97ee95b4da30225534853c4bc3ba59efbcb21476 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 27 Jan 2018 13:26:43 -0600 Subject: [PATCH] Fix some error handling --- app/Exceptions/Handler.php | 4 ++-- .../Api/Application/Nodes/AllocationController.php | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 952d94335..111d2a6b8 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -83,14 +83,14 @@ class Handler extends ExceptionHandler $cleaned[] = snake_case($reason); } - return [$field => $cleaned]; + return [str_replace('.', '_', $field) => $cleaned]; })->toArray(); $errors = collect($exception->errors())->map(function ($errors, $field) use ($codes) { $response = []; foreach ($errors as $key => $error) { $response[] = [ - 'code' => array_get($codes, $field . '.' . $key), + 'code' => array_get($codes, str_replace('.', '_', $field) . '.' . $key), 'detail' => $error, 'source' => ['field' => $field], ]; diff --git a/app/Http/Controllers/Api/Application/Nodes/AllocationController.php b/app/Http/Controllers/Api/Application/Nodes/AllocationController.php index ef35e91c5..b63f3e203 100644 --- a/app/Http/Controllers/Api/Application/Nodes/AllocationController.php +++ b/app/Http/Controllers/Api/Application/Nodes/AllocationController.php @@ -26,11 +26,6 @@ class AllocationController extends ApplicationApiController */ private $deletionService; - /** - * @var \Spatie\Fractal\Fractal - */ - private $fractal; - /** * @var \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface */