@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | class AjaxValidator |
14 | 14 | { |
15 | - public function validate(array $values = [], $resource, $method = 'store') |
|
15 | + public function validate(array $values = [ ], $resource, $method = 'store') |
|
16 | 16 | { |
17 | 17 | $rules = config('validator.rules.' . $resource); |
18 | 18 | $extraRules = config('validator.rules.whenUpdate.' . $resource); |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | $attributes = array_keys($allRules); |
25 | 25 | } |
26 | 26 | $validator = Validator::make($values, $rules, $messages, $attributes); |
27 | - $validator->sometimes(array_keys($extraRules), $extraRules, function ($method) use ($method) { |
|
27 | + $validator->sometimes(array_keys($extraRules), $extraRules, function($method) use ($method) { |
|
28 | 28 | return $method === 'update'; |
29 | 29 | }); |
30 | 30 | if ($validator->fails()) { |
31 | - response()->json(['status' => 'failed', 'code' => 422, 'message' => $validator->errors()])->send(); |
|
31 | + response()->json([ 'status' => 'failed', 'code' => 422, 'message' => $validator->errors() ])->send(); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | } |
35 | 35 | \ No newline at end of file |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function register() |
27 | 27 | { |
28 | - $this->app->singleton('Cals\Validator\AjaxValidator', function ($app) { |
|
28 | + $this->app->singleton('Cals\Validator\AjaxValidator', function($app) { |
|
29 | 29 | return new AjaxValidator(); |
30 | 30 | }); |
31 | 31 | } |