1 | <?php |
||
2 | /** |
||
3 | * Created by PhpStorm. |
||
4 | * User: Mohammad Shamaseen |
||
5 | * Date: 09/10/18 |
||
6 | * Time: 01:01 م. |
||
7 | */ |
||
8 | |||
9 | namespace Shamaseen\Repository\Generator\Utility; |
||
10 | |||
11 | use App; |
||
12 | use Illuminate\Contracts\Validation\Validator; |
||
13 | use Illuminate\Foundation\Http\FormRequest; |
||
0 ignored issues
–
show
|
|||
14 | use Illuminate\Http\Exceptions\HttpResponseException; |
||
15 | use Illuminate\Http\JsonResponse; |
||
16 | use Illuminate\Validation\ValidationException; |
||
17 | use Response; |
||
18 | |||
19 | /** |
||
20 | * Class BaseRequests. |
||
21 | */ |
||
22 | class Request extends FormRequest |
||
23 | { |
||
24 | /** |
||
25 | * @param Validator $validator |
||
26 | * |
||
27 | * @throws ValidationException |
||
28 | */ |
||
29 | protected function failedValidation(Validator $validator) |
||
30 | { |
||
31 | if (false !== strpos($this->path(), 'api')) { |
||
32 | $errors = (new ValidationException($validator))->errors(); |
||
33 | throw new HttpResponseException(Response::json(['success' => false, 'errors' => $errors, |
||
34 | ], JsonResponse::HTTP_UNPROCESSABLE_ENTITY)); |
||
35 | } |
||
36 | parent::failedValidation($validator); |
||
37 | } |
||
38 | |||
39 | public function rules() |
||
40 | { |
||
41 | App::setLocale($this->header('Language', 'en')); |
||
42 | } |
||
43 | } |
||
44 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths