Fix some error handling
This commit is contained in:
parent
8afced3410
commit
97ee95b4da
2 changed files with 2 additions and 7 deletions
|
@ -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],
|
||||
];
|
||||
|
|
|
@ -26,11 +26,6 @@ class AllocationController extends ApplicationApiController
|
|||
*/
|
||||
private $deletionService;
|
||||
|
||||
/**
|
||||
* @var \Spatie\Fractal\Fractal
|
||||
*/
|
||||
private $fractal;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\AllocationRepositoryInterface
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue