1 | <?php |
||
15 | class JsValidatorFactory |
||
16 | { |
||
17 | /** |
||
18 | * The application instance. |
||
19 | * |
||
20 | * @var \Illuminate\Contracts\Container\Container |
||
21 | */ |
||
22 | protected $app; |
||
23 | |||
24 | /** |
||
25 | * Configuration options. |
||
26 | * |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $options; |
||
30 | |||
31 | /** |
||
32 | * Create a new Validator factory instance. |
||
33 | * |
||
34 | * @param \Illuminate\Contracts\Container\Container $app |
||
35 | * @param array $options |
||
36 | */ |
||
37 | 6 | public function __construct($app, array $options = []) |
|
42 | |||
43 | 6 | protected function setOptions($options) { |
|
50 | |||
51 | |||
52 | /** |
||
53 | * Creates JsValidator instance based on rules and message arrays. |
||
54 | * |
||
55 | * @param array $rules |
||
56 | * @param array $messages |
||
57 | * @param array $customAttributes |
||
58 | * @param null|string $selector |
||
59 | * |
||
60 | * @return JavascriptValidator |
||
61 | */ |
||
62 | 2 | public function make(array $rules, array $messages = array(), array $customAttributes = array(), $selector = null) |
|
68 | |||
69 | /** |
||
70 | * Get the validator instance for the request. |
||
71 | * |
||
72 | * @return \Illuminate\Validation\Validator |
||
73 | */ |
||
74 | 4 | protected function getValidatorInstance(array $rules, array $messages = array(), array $customAttributes = array()) |
|
83 | |||
84 | /** |
||
85 | * Creates JsValidator instance based on FormRequest. |
||
86 | * |
||
87 | * @param $formRequest |
||
88 | * @param null $selector |
||
89 | * |
||
90 | * @return JavascriptValidator |
||
91 | * |
||
92 | * @throws FormRequestArgumentException |
||
93 | */ |
||
94 | 3 | public function formRequest($formRequest, $selector = null) |
|
110 | |||
111 | /** |
||
112 | * Creates and initializes an Form Request instance. |
||
113 | * |
||
114 | * @param string $class |
||
115 | * |
||
116 | * @return FormRequest |
||
117 | */ |
||
118 | protected function createFormRequest($class) |
||
133 | |||
134 | /** |
||
135 | * Creates JsValidator instance based on Validator. |
||
136 | * |
||
137 | * @param \Illuminate\Validation\Validator $validator |
||
138 | * @param string|null $selector |
||
139 | * |
||
140 | * @return JavascriptValidator |
||
141 | */ |
||
142 | 4 | public function validator(Validator $validator, $selector = null) |
|
146 | |||
147 | /** |
||
148 | * Creates JsValidator instance based on Validator. |
||
149 | * |
||
150 | * @param \Illuminate\Validation\Validator $validator |
||
151 | * @param string|null $selector |
||
152 | * |
||
153 | * @return JavascriptValidator |
||
154 | */ |
||
155 | 4 | protected function jsValidator(Validator $validator, $selector = null) |
|
171 | |||
172 | /** |
||
173 | * Get and encrypt token from session store. |
||
174 | * |
||
175 | * @return null|string |
||
176 | */ |
||
177 | 4 | protected function getSessionToken() |
|
190 | |||
191 | } |
||
192 |