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 | /** |
||
99 | * Check if JS Validation is disabled for attribute. |
||
100 | * |
||
101 | * @param $attribute |
||
102 | * |
||
103 | * @return bool |
||
104 | */ |
||
105 | public function jsValidationEnabled($attribute) |
||
109 | |||
110 | /** |
||
111 | * Returns view data to render javascript. |
||
112 | * |
||
113 | * @param bool $remote |
||
114 | * @return array |
||
115 | */ |
||
116 | public function validationData($remote=true) |
||
126 | |||
127 | |||
128 | |||
129 | } |
||
130 |