mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 05:04:07 -08:00
this works, need to write up pr
This commit is contained in:
parent
b67b00dd82
commit
53bd5626c9
|
@ -4,6 +4,7 @@ namespace App\Exceptions;
|
|||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use App\Helpers\Helper;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use ArieTimmerman\Laravel\SCIMServer\Exceptions\SCIMException;
|
||||
|
@ -150,6 +151,11 @@ class Handler extends ExceptionHandler
|
|||
return redirect()->guest('login');
|
||||
}
|
||||
|
||||
protected function invalidJson($request, ValidationException $exception)
|
||||
{
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, $exception->errors()), 200);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed for validation exceptions.
|
||||
|
|
|
@ -15,8 +15,8 @@ class StoreAssetRequest extends ImageUploadRequest
|
|||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
//TODO: make sure this works
|
||||
//return Gate::allows('create', new Asset);
|
||||
// TODO: make sure this works
|
||||
return Gate::allows('create', new Asset);
|
||||
}
|
||||
|
||||
public function prepareForValidation(): void
|
||||
|
@ -36,13 +36,11 @@ class StoreAssetRequest extends ImageUploadRequest
|
|||
parent::rules(),
|
||||
);
|
||||
|
||||
if(!$this->expectsJson()) {
|
||||
//accepts an array for the gui form
|
||||
// unsets unique check here, that check cannot run twice.
|
||||
$rules['asset_tags.*'] = $rules['asset_tag'];
|
||||
unset($rules['asset_tag']);
|
||||
$rules['serials.*'] = $rules['serial'];
|
||||
unset($rules['serial']);
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue