validation.php 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://hyperf.wiki
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. return [
  12. /*
  13. |--------------------------------------------------------------------------
  14. | Validation Language Lines
  15. |--------------------------------------------------------------------------
  16. |
  17. | The following language lines contain the default error messages used by
  18. | the validator class. Some of these rules have multiple versions such
  19. | as the size rules. Feel free to tweak each of these messages here.
  20. |
  21. */
  22. 'accepted' => 'The :attribute must be accepted.',
  23. 'active_url' => 'The :attribute is not a valid URL.',
  24. 'after' => 'The :attribute must be a date after :date.',
  25. 'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
  26. 'alpha' => 'The :attribute may only contain letters.',
  27. 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
  28. 'alpha_num' => 'The :attribute may only contain letters and numbers.',
  29. 'array' => 'The :attribute must be an array.',
  30. 'before' => 'The :attribute must be a date before :date.',
  31. 'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
  32. 'between' => [
  33. 'numeric' => 'The :attribute must be between :min and :max.',
  34. 'file' => 'The :attribute must be between :min and :max kilobytes.',
  35. 'string' => 'The :attribute must be between :min and :max characters.',
  36. 'array' => 'The :attribute must have between :min and :max items.',
  37. ],
  38. 'boolean' => 'The :attribute field must be true or false.',
  39. 'confirmed' => 'The :attribute confirmation does not match.',
  40. 'date' => 'The :attribute is not a valid date.',
  41. 'date_format' => 'The :attribute does not match the format :format.',
  42. 'decimal' => 'The :attribute must have :decimal decimal places.',
  43. 'different' => 'The :attribute and :other must be different.',
  44. 'digits' => 'The :attribute must be :digits digits.',
  45. 'digits_between' => 'The :attribute must be between :min and :max digits.',
  46. 'dimensions' => 'The :attribute has invalid image dimensions.',
  47. 'distinct' => 'The :attribute field has a duplicate value.',
  48. 'email' => 'The :attribute must be a valid email address.',
  49. 'exists' => 'The selected :attribute is invalid.',
  50. 'file' => 'The :attribute must be a file.',
  51. 'filled' => 'The :attribute field is required.',
  52. 'gt' => [
  53. 'numeric' => 'The :attribute must be greater than :value',
  54. 'file' => 'The :attribute must be greater than :value kb',
  55. 'string' => 'The :attribute must be greater than :value characters',
  56. 'array' => 'The :attribute must be greater than :value items',
  57. ],
  58. 'gte' => [
  59. 'numeric' => 'The :attribute must be great than or equal to :value',
  60. 'file' => 'The :attribute must be great than or equal to :value kb',
  61. 'string' => 'The :attribute must be great than or equal to :value characters',
  62. 'array' => 'The :attribute must be great than or equal to :value items',
  63. ],
  64. 'image' => 'The :attribute must be an image.',
  65. 'in' => 'The selected :attribute is invalid.',
  66. 'in_array' => 'The :attribute field does not exist in :other.',
  67. 'integer' => 'The :attribute must be an integer.',
  68. 'ip' => 'The :attribute must be a valid IP address.',
  69. 'ipv4' => 'The :attribute must be a valid IPv4 address.',
  70. 'ipv6' => 'The :attribute must be a valid IPv6 address.',
  71. 'json' => 'The :attribute must be a valid JSON string.',
  72. 'lt' => [
  73. 'numeric' => 'The :attribute must be less than :value',
  74. 'file' => 'The :attribute must be less than :value kb',
  75. 'string' => 'The :attribute must be less than :value characters',
  76. 'array' => 'The :attribute must be less than :value items',
  77. ],
  78. 'lte' => [
  79. 'numeric' => 'The :attribute must be less than or equal to :value',
  80. 'file' => 'The :attribute must be less than or equal to :value kb',
  81. 'string' => 'The :attribute must be less than or equal to :value characters',
  82. 'array' => 'The :attribute must be less than or equal to :value items',
  83. ],
  84. 'max' => [
  85. 'numeric' => 'The :attribute may not be greater than :max.',
  86. 'file' => 'The :attribute may not be greater than :max kilobytes.',
  87. 'string' => 'The :attribute may not be greater than :max characters.',
  88. 'array' => 'The :attribute may not have more than :max items.',
  89. ],
  90. 'mimes' => 'The :attribute must be a file of type: :values.',
  91. 'mimetypes' => 'The :attribute must be a file of type: :values.',
  92. 'min' => [
  93. 'numeric' => 'The :attribute must be at least :min.',
  94. 'file' => 'The :attribute must be at least :min kilobytes.',
  95. 'string' => 'The :attribute must be at least :min characters.',
  96. 'array' => 'The :attribute must have at least :min items.',
  97. ],
  98. 'not_in' => 'The selected :attribute is invalid.',
  99. 'not_regex' => 'The :attribute cannot match a given regular rule.',
  100. 'numeric' => 'The :attribute must be a number.',
  101. 'present' => 'The :attribute field must be present.',
  102. 'regex' => 'The :attribute format is invalid.',
  103. 'required' => 'The :attribute field is required.',
  104. 'required_if' => 'The :attribute field is required when :other is :value.',
  105. 'required_unless' => 'The :attribute field is required unless :other is in :values.',
  106. 'required_with' => 'The :attribute field is required when :values is present.',
  107. 'required_with_all' => 'The :attribute field is required when :values is present.',
  108. 'required_without' => 'The :attribute field is required when :values is not present.',
  109. 'required_without_all' => 'The :attribute field is required when none of :values are present.',
  110. 'same' => 'The :attribute and :other must match.',
  111. 'size' => [
  112. 'numeric' => 'The :attribute must be :size.',
  113. 'file' => 'The :attribute must be :size kilobytes.',
  114. 'string' => 'The :attribute must be :size characters.',
  115. 'array' => 'The :attribute must contain :size items.',
  116. ],
  117. 'starts_with' => 'The :attribute must be start with :values ',
  118. 'string' => 'The :attribute must be a string.',
  119. 'timezone' => 'The :attribute must be a valid zone.',
  120. 'unique' => 'The :attribute has already been taken.',
  121. 'uploaded' => 'The :attribute failed to upload.',
  122. 'url' => 'The :attribute format is invalid.',
  123. 'uuid' => 'The :attribute is invalid UUID.',
  124. 'max_if' => [
  125. 'numeric' => 'The :attribute may not be greater than :max when :other is :value.',
  126. 'file' => 'The :attribute may not be greater than :max kilobytes when :other is :value.',
  127. 'string' => 'The :attribute may not be greater than :max characters when :other is :value.',
  128. 'array' => 'The :attribute may not have more than :max items when :other is :value.',
  129. ],
  130. 'min_if' => [
  131. 'numeric' => 'The :attribute must be at least :min when :other is :value.',
  132. 'file' => 'The :attribute must be at least :min kilobytes when :other is :value.',
  133. 'string' => 'The :attribute must be at least :min characters when :other is :value.',
  134. 'array' => 'The :attribute must have at least :min items when :other is :value.',
  135. ],
  136. 'between_if' => [
  137. 'numeric' => 'The :attribute must be between :min and :max when :other is :value.',
  138. 'file' => 'The :attribute must be between :min and :max kilobytes when :other is :value.',
  139. 'string' => 'The :attribute must be between :min and :max characters when :other is :value.',
  140. 'array' => 'The :attribute must have between :min and :max items when :other is :value.',
  141. ],
  142. /*
  143. |--------------------------------------------------------------------------
  144. | Custom Validation Language Lines
  145. |--------------------------------------------------------------------------
  146. |
  147. | Here you may specify custom validation messages for attributes using the
  148. | convention "attribute.rule" to name the lines. This makes it quick to
  149. | specify a specific custom language line for a given attribute rule.
  150. |
  151. */
  152. 'custom' => [
  153. 'attribute-name' => [
  154. 'rule-name' => 'custom-message',
  155. ],
  156. ],
  157. /*
  158. |--------------------------------------------------------------------------
  159. | Custom Validation Attributes
  160. |--------------------------------------------------------------------------
  161. |
  162. | The following language lines are used to swap attribute place-holders
  163. | with something more reader friendly such as E-Mail Address instead
  164. | of "email". This simply helps us make messages a little cleaner.
  165. |
  166. */
  167. 'attributes' => [],
  168. 'phone_number' => 'The :attribute must be a valid phone number',
  169. 'telephone_number' => 'The :attribute must be a valid telephone number',
  170. 'chinese_word' => 'The :attribute must contain valid characters(chinese/english character, number, underscore)',
  171. 'sequential_array' => 'The :attribute must be sequential array',
  172. ];