| Conditions | 3 |
| Paths | 3 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public static function apiErrorResponse($errors, $inputs) |
||
| 31 | { |
||
| 32 | $message = []; |
||
| 33 | foreach ($inputs as $key => $value) { |
||
| 34 | if (!isset($errors[$key])) { |
||
| 35 | $message[$key] = [ |
||
| 36 | 'status' => 'valid', |
||
| 37 | 'value' => $value, |
||
| 38 | ]; |
||
| 39 | } else { |
||
| 40 | $message[$key] = [ |
||
| 41 | 'status' => 'invalid', |
||
| 42 | 'error' => $errors[$key], |
||
| 43 | 'value' => $value, |
||
| 44 | ]; |
||
| 45 | } |
||
| 46 | } |
||
| 47 | |||
| 48 | return Response::json(['status' => 'error', 'data' => $message]); |
||
| 49 | } |
||
| 50 | } |
||
| 51 |