1 | <?php |
||
10 | class Resolver |
||
11 | { |
||
12 | use AccessProtectedTrait; |
||
13 | |||
14 | /** |
||
15 | * @var \Closure |
||
16 | */ |
||
17 | protected $resolver; |
||
18 | |||
19 | /** |
||
20 | * @var \Illuminate\Contracts\Validation\Factory |
||
21 | */ |
||
22 | protected $factory; |
||
23 | |||
24 | /** |
||
25 | * Whether to escape validation messages. |
||
26 | * |
||
27 | * @var bool |
||
28 | */ |
||
29 | protected $escape; |
||
30 | |||
31 | /** |
||
32 | * RemoteValidator constructor. |
||
33 | * |
||
34 | * @param \Illuminate\Contracts\Validation\Factory $factory |
||
35 | * @param bool $escape |
||
36 | */ |
||
37 | 72 | public function __construct(ValidationFactory $factory, $escape = false) |
|
43 | |||
44 | /** |
||
45 | * Closure used to resolve Validator instance. |
||
46 | * |
||
47 | * @param $field |
||
48 | * @return \Closure |
||
49 | */ |
||
50 | 60 | public function resolver($field) |
|
51 | { |
||
52 | return function ($translator, $data, $rules, $messages, $customAttributes) use ($field) { |
||
53 | 36 | return $this->resolve($translator, $data, $rules, $messages, $customAttributes, $field); |
|
54 | 60 | }; |
|
55 | } |
||
56 | |||
57 | /** |
||
58 | * Resolves Validator instance. |
||
59 | * |
||
60 | * @param $translator |
||
61 | * @param $data |
||
62 | * @param $rules |
||
63 | * @param $messages |
||
64 | * @param $customAttributes |
||
65 | * @param $field |
||
66 | * @return \Illuminate\Validation\Validator |
||
67 | */ |
||
68 | 36 | protected function resolve($translator, $data, $rules, $messages, $customAttributes, $field) |
|
77 | |||
78 | /** |
||
79 | * Create new validator instance. |
||
80 | * |
||
81 | * @param $translator |
||
82 | * @param $data |
||
83 | * @param $rules |
||
84 | * @param $messages |
||
85 | * @param $customAttributes |
||
86 | * @return \Illuminate\Validation\Validator |
||
87 | */ |
||
88 | 36 | protected function createValidator($translator, $data, $rules, $messages, $customAttributes) |
|
96 | |||
97 | /** |
||
98 | * Closure used to trigger JsValidations. |
||
99 | * |
||
100 | * @return \Closure |
||
101 | */ |
||
102 | 36 | public function validatorClosure() |
|
111 | } |
||
112 |