validation.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. 'list' => 'The :attribute must be a list.',
  73. 'lt' => [
  74. 'numeric' => 'The :attribute must be less than :value',
  75. 'file' => 'The :attribute must be less than :value kb',
  76. 'string' => 'The :attribute must be less than :value characters',
  77. 'array' => 'The :attribute must be less than :value items',
  78. ],
  79. 'lte' => [
  80. 'numeric' => 'The :attribute must be less than or equal to :value',
  81. 'file' => 'The :attribute must be less than or equal to :value kb',
  82. 'string' => 'The :attribute must be less than or equal to :value characters',
  83. 'array' => 'The :attribute must be less than or equal to :value items',
  84. ],
  85. 'max' => [
  86. 'numeric' => 'The :attribute may not be greater than :max.',
  87. 'file' => 'The :attribute may not be greater than :max kilobytes.',
  88. 'string' => 'The :attribute may not be greater than :max characters.',
  89. 'array' => 'The :attribute may not have more than :max items.',
  90. ],
  91. 'mimes' => 'The :attribute must be a file of type: :values.',
  92. 'mimetypes' => 'The :attribute must be a file of type: :values.',
  93. 'min' => [
  94. 'numeric' => 'The :attribute must be at least :min.',
  95. 'file' => 'The :attribute must be at least :min kilobytes.',
  96. 'string' => 'The :attribute must be at least :min characters.',
  97. 'array' => 'The :attribute must have at least :min items.',
  98. ],
  99. 'not_in' => 'The selected :attribute is invalid.',
  100. 'not_regex' => 'The :attribute cannot match a given regular rule.',
  101. 'numeric' => 'The :attribute must be a number.',
  102. 'present' => 'The :attribute field must be present.',
  103. 'regex' => 'The :attribute format is invalid.',
  104. 'required' => 'The :attribute field is required.',
  105. 'required_if' => 'The :attribute field is required when :other is :value.',
  106. 'required_unless' => 'The :attribute field is required unless :other is in :values.',
  107. 'required_with' => 'The :attribute field is required when :values is present.',
  108. 'required_with_all' => 'The :attribute field is required when :values is present.',
  109. 'required_without' => 'The :attribute field is required when :values is not present.',
  110. 'required_without_all' => 'The :attribute field is required when none of :values are present.',
  111. 'same' => 'The :attribute and :other must match.',
  112. 'size' => [
  113. 'numeric' => 'The :attribute must be :size.',
  114. 'file' => 'The :attribute must be :size kilobytes.',
  115. 'string' => 'The :attribute must be :size characters.',
  116. 'array' => 'The :attribute must contain :size items.',
  117. ],
  118. 'starts_with' => 'The :attribute must be start with :values ',
  119. 'string' => 'The :attribute must be a string.',
  120. 'timezone' => 'The :attribute must be a valid zone.',
  121. 'unique' => 'The :attribute has already been taken.',
  122. 'uploaded' => 'The :attribute failed to upload.',
  123. 'url' => 'The :attribute format is invalid.',
  124. 'uuid' => 'The :attribute is invalid UUID.',
  125. 'max_if' => [
  126. 'numeric' => 'The :attribute may not be greater than :max when :other is :value.',
  127. 'file' => 'The :attribute may not be greater than :max kilobytes when :other is :value.',
  128. 'string' => 'The :attribute may not be greater than :max characters when :other is :value.',
  129. 'array' => 'The :attribute may not have more than :max items when :other is :value.',
  130. ],
  131. 'min_if' => [
  132. 'numeric' => 'The :attribute must be at least :min when :other is :value.',
  133. 'file' => 'The :attribute must be at least :min kilobytes when :other is :value.',
  134. 'string' => 'The :attribute must be at least :min characters when :other is :value.',
  135. 'array' => 'The :attribute must have at least :min items when :other is :value.',
  136. ],
  137. 'between_if' => [
  138. 'numeric' => 'The :attribute must be between :min and :max when :other is :value.',
  139. 'file' => 'The :attribute must be between :min and :max kilobytes when :other is :value.',
  140. 'string' => 'The :attribute must be between :min and :max characters when :other is :value.',
  141. 'array' => 'The :attribute must have between :min and :max items when :other is :value.',
  142. ],
  143. /*
  144. |--------------------------------------------------------------------------
  145. | Custom Validation Language Lines
  146. |--------------------------------------------------------------------------
  147. |
  148. | Here you may specify custom validation messages for attributes using the
  149. | convention "attribute.rule" to name the lines. This makes it quick to
  150. | specify a specific custom language line for a given attribute rule.
  151. |
  152. */
  153. 'custom' => [
  154. 'attribute-name' => [
  155. 'rule-name' => 'custom-message',
  156. ],
  157. ],
  158. /*
  159. |--------------------------------------------------------------------------
  160. | Custom Validation Attributes
  161. |--------------------------------------------------------------------------
  162. |
  163. | The following language lines are used to swap attribute place-holders
  164. | with something more reader friendly such as E-Mail Address instead
  165. | of "email". This simply helps us make messages a little cleaner.
  166. |
  167. */
  168. 'attributes' => [],
  169. 'phone_number' => 'The :attribute must be a valid phone number',
  170. 'telephone_number' => 'The :attribute must be a valid telephone number',
  171. 'chinese_word' => 'The :attribute must contain valid characters(chinese/english character, number, underscore)',
  172. 'sequential_array' => 'The :attribute must be sequential array',
  173. ];