1 | <?php namespace Arcanedev\LaravelApiHelper\Http; |
||
12 | abstract class FormRequest extends BaseFormRequest |
||
13 | { |
||
14 | /* ----------------------------------------------------------------- |
||
15 | | Properties |
||
16 | | ----------------------------------------------------------------- |
||
17 | */ |
||
18 | |||
19 | /** |
||
20 | * Status code when the validation fails. |
||
21 | * |
||
22 | * @var int |
||
23 | */ |
||
24 | protected $statusCode = 422; |
||
25 | |||
26 | /* ----------------------------------------------------------------- |
||
27 | | Main Methods |
||
28 | | ----------------------------------------------------------------- |
||
29 | */ |
||
30 | |||
31 | /** |
||
32 | * Get the proper failed validation response for the request. |
||
33 | * |
||
34 | * @param array $errors |
||
35 | * |
||
36 | * @return \Symfony\Component\HttpFoundation\Response |
||
37 | */ |
||
38 | 3 | public function response(array $errors) |
|
44 | |||
45 | /* ----------------------------------------------------------------- |
||
46 | | Other Methods |
||
47 | | ----------------------------------------------------------------- |
||
48 | */ |
||
49 | |||
50 | /** |
||
51 | * Get the json response with validation errors. |
||
52 | * |
||
53 | * @param array $errors |
||
54 | * |
||
55 | * @return \Illuminate\Http\JsonResponse |
||
56 | */ |
||
57 | 3 | protected function getJsonResponse($errors) |
|
64 | |||
65 | /** |
||
66 | * Format the json response. |
||
67 | * |
||
68 | * @param array $errors |
||
69 | * |
||
70 | * @return array |
||
71 | */ |
||
72 | 3 | protected function formatJsonResponseErrors(array $errors) |
|
80 | } |
||
81 |