Fix some error handling

This commit is contained in:
Dane Everitt 2018-01-27 13:26:43 -06:00
parent 8afced3410
commit 97ee95b4da
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
2 changed files with 2 additions and 7 deletions

View File

@ -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],
];

View File

@ -26,11 +26,6 @@ class AllocationController extends ApplicationApiController
*/
private $deletionService;
/**
* @var \Spatie\Fractal\Fractal
*/
private $fractal;
/**
* @var \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface
*/