1 | <?php |
||
9 | class ValidatorParser |
||
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 | /** |
||
22 | * @var RuleParser |
||
23 | */ |
||
24 | protected $rules; |
||
25 | /** |
||
26 | * @var MessageParser |
||
27 | */ |
||
28 | protected $messages; |
||
29 | |||
30 | /** |
||
31 | * Create a new JsValidation instance. |
||
32 | * |
||
33 | * @param RuleParser $rules |
||
34 | * @param MessageParser $messages |
||
35 | */ |
||
36 | public function __construct(RuleParser $rules, MessageParser $messages) |
||
43 | |||
44 | /** |
||
45 | * Sets delegated Validator instance. |
||
46 | * |
||
47 | * @param \Proengsoft\JsValidation\Support\DelegatedValidator $validator |
||
48 | */ |
||
49 | public function setDelegatedValidator(DelegatedValidator $validator) { |
||
54 | |||
55 | |||
56 | 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 | protected function jsConvertRules($attribute, $rules, $includeRemote) |
||
96 | |||
97 | /** |
||
98 | * Check if rule should be validated with javascript |
||
99 | * |
||
100 | * @param $jsRule |
||
101 | * @param $includeRemote |
||
102 | * @return bool |
||
103 | */ |
||
104 | protected function isValidatable($jsRule, $includeRemote) { |
||
107 | |||
108 | |||
109 | /** |
||
110 | * Check if JS Validation is disabled for attribute. |
||
111 | * |
||
112 | * @param $attribute |
||
113 | * |
||
114 | * @return bool |
||
115 | */ |
||
116 | public function jsValidationEnabled($attribute) |
||
120 | |||
121 | /** |
||
122 | * Returns view data to render javascript. |
||
123 | * |
||
124 | * @param bool $remote |
||
125 | * @return array |
||
126 | */ |
||
127 | public function validationData($remote=true) |
||
137 | |||
138 | |||
139 | |||
140 | } |
||
141 |