Conditions | 2 |
Paths | 2 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public function render() |
||
20 | { |
||
21 | dd($this->validator->errors()->first()); |
||
22 | if ($this->validator->errors()->first() == 'validation.in') { |
||
23 | return response()->json([ |
||
|
|||
24 | 'code' => 'INVALID_GENDER', |
||
25 | 'validationResult' => [ |
||
26 | 'resultType' => 'INVALID_GENDER', |
||
27 | 'valid' => false, |
||
28 | ], |
||
29 | ]); |
||
30 | } |
||
31 | |||
32 | return response()->json([ |
||
33 | 'code' => 'INVALID_NAME', |
||
34 | 'validationResult' => [ |
||
35 | 'resultType' => 'VALIDATION_ERROR_UNKNOWN', |
||
36 | 'additionalInfo' => null, |
||
37 | 'valid' => false, |
||
38 | ], |
||
39 | 'suggestions' => [], |
||
40 | ]); |
||
41 | } |
||
42 | } |
||
43 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: