1 | <?php |
||
10 | class EcuadorIdentificationValidator extends Validator |
||
11 | { |
||
12 | /** |
||
13 | * Validation types |
||
14 | * |
||
15 | * @var array |
||
16 | */ |
||
17 | private $types = [ |
||
18 | 'final_customer' => 'validateFinalConsumer', |
||
19 | 'personal_identification' => 'validatePersonalIdentification', |
||
20 | 'natural_ruc' => 'validateNaturalRuc', |
||
21 | 'public_ruc' => 'validatePublicRuc', |
||
22 | 'private_ruc' => 'validatePrivateRuc', |
||
23 | 'ruc' => 'validateRuc', |
||
24 | 'is_natural_person' => 'validateIsNaturalPersons', |
||
25 | 'is_juridical_person' => 'validateIsJuridicalPersons', |
||
26 | 'all_identifications' => 'validateAllTypeIdentification', |
||
27 | ]; |
||
28 | |||
29 | /** |
||
30 | * Validate that the Ecuadorian identification is valid |
||
31 | * |
||
32 | * @param $attribute |
||
33 | * @param $value |
||
34 | * @param $parameters |
||
35 | * @return bool |
||
36 | * @throws \Exception |
||
37 | */ |
||
38 | public function validateEcuador($attribute, $value, $parameters) |
||
50 | |||
51 | /** |
||
52 | * Get the translated message or the default message. |
||
53 | * |
||
54 | * @param $attribute |
||
55 | * @param $rule |
||
56 | * @return mixed|string |
||
57 | */ |
||
58 | protected function getMessageEcuador($attribute, $rule) |
||
66 | |||
67 | /** |
||
68 | * Get the translated attribute or the default attribute. |
||
69 | * |
||
70 | * @param $attribute |
||
71 | * @return mixed |
||
72 | */ |
||
73 | protected function getAttributeEcuador($attribute) |
||
81 | |||
82 | /** |
||
83 | * Determine if the data passes the validation rules. |
||
84 | * |
||
85 | * @param $parameters |
||
86 | * @param $value |
||
87 | * @return bool |
||
88 | */ |
||
89 | protected function passesEcuador($parameters, $value) |
||
95 | } |
||
96 |