1 | <?php |
||
9 | class ValidatorHandler |
||
10 | { |
||
11 | use UseDelegatedValidatorTrait; |
||
12 | |||
13 | /** |
||
14 | * Rule used to disable validations. |
||
15 | * |
||
16 | * @const string |
||
17 | */ |
||
18 | const JSVALIDATION_DISABLE = 'NoJsValidation'; |
||
19 | |||
20 | /** |
||
21 | * @var RuleParser |
||
22 | */ |
||
23 | protected $rules; |
||
24 | /** |
||
25 | * @var MessageParser |
||
26 | */ |
||
27 | protected $messages; |
||
28 | |||
29 | /** |
||
30 | * Create a new JsValidation instance. |
||
31 | * |
||
32 | * @param RuleParser $rules |
||
33 | * @param MessageParser $messages |
||
34 | */ |
||
35 | 6 | public function __construct(RuleParser $rules, MessageParser $messages) |
|
41 | |||
42 | /** |
||
43 | * Sets delegated Validator instance. |
||
44 | * |
||
45 | * @param \Proengsoft\JsValidation\Support\DelegatedValidator $validator |
||
46 | */ |
||
47 | 2 | public function setDelegatedValidator(DelegatedValidator $validator) |
|
53 | |||
54 | 2 | protected function generateJavascriptValidations($includeRemote = true) |
|
69 | |||
70 | /** |
||
71 | * Make Laravel Validations compatible with JQuery Validation Plugin. |
||
72 | * |
||
73 | * @param $attribute |
||
74 | * @param $rules |
||
75 | * @param $includeRemote |
||
76 | * |
||
77 | * @return array |
||
78 | */ |
||
79 | 1 | protected function jsConvertRules($attribute, $rules, $includeRemote) |
|
95 | |||
96 | /** |
||
97 | * Check if rule should be validated with javascript. |
||
98 | * |
||
99 | * @param $jsRule |
||
100 | * @param $includeRemote |
||
101 | * @return bool |
||
102 | */ |
||
103 | 1 | protected function isValidatable($jsRule, $includeRemote) |
|
107 | |||
108 | /** |
||
109 | * Check if JS Validation is disabled for attribute. |
||
110 | * |
||
111 | * @param $attribute |
||
112 | * |
||
113 | * @return bool |
||
114 | */ |
||
115 | 2 | public function jsValidationEnabled($attribute) |
|
119 | |||
120 | /** |
||
121 | * Returns view data to render javascript. |
||
122 | * |
||
123 | * @param bool $remote |
||
124 | * @return array |
||
125 | */ |
||
126 | 2 | public function validationData($remote = true) |
|
136 | } |
||
137 |