diff --git a/application/language/ar/validation.php b/application/language/ar/validation.php index cb15db34..fb88f6d8 100644 --- a/application/language/ar/validation.php +++ b/application/language/ar/validation.php @@ -24,6 +24,7 @@ "alpha" => "القيمة :attribute يمكنها أن تحتوي على أحرف فقط.", "alpha_dash" => "القيمة :attribute يمكنها أن تحتوي على أحرف و أرقام و إشارة الناقص فقط.", "alpha_num" => "القيمة :attribute يمكنها أن تحتوي على أحرف و أرقام فقط.", + "array" => "The :attribute must have selected elements.", "before" => "القيمة :attribute يجب أن تكون قبل تاريخ :date.", "between" => array( "numeric" => "القيمة :attribute يجب أن تكون بين :min و :max.", @@ -31,6 +32,10 @@ "string" => "النص :attribute يجب أن يكون بطول من :min إلى :max حرف.", ), "confirmed" => "القيمة :attribute التأكيدية غير مطابقة.", + "count" => "The :attribute must have exactly :count selected elements.", + "countbetween" => "The :attribute must have between :min and :max selected elements.", + "countmax" => "The :attribute must have less than :max selected elements.", + "countmin" => "The :attribute must have at least :min selected elements.", "different" => "القيمتان :attribute و :other يجب أن تختلفان.", "email" => "القيمة :attribute تمثل بريد إلكتروني غير صحيح.", "exists" => "القيمة المختارة :attribute غير موجودة.", diff --git a/application/language/bg/validation.php b/application/language/bg/validation.php index 4e46f6ff..fe01d9be 100644 --- a/application/language/bg/validation.php +++ b/application/language/bg/validation.php @@ -24,6 +24,7 @@ "alpha" => "Полето :attribute трябва да съдържа само букви.", "alpha_dash" => "Полето :attribute трябва да съдържа само букви, цифри, долна черта и тире.", "alpha_num" => "Полето :attribute трябва да съдържа само букви и цифри.", + "array" => "The :attribute must have selected elements.", "before" => "Полето :attribute трябва да бъде дата преди :date.", "between" => array( "numeric" => "Полето :attribute трябва да бъде между :min и :max.", @@ -31,6 +32,10 @@ "string" => "Полето :attribute трябва да бъде между :min и :max знака.", ), "confirmed" => "Полето :attribute не е потвърдено.", + "count" => "The :attribute must have exactly :count selected elements.", + "countbetween" => "The :attribute must have between :min and :max selected elements.", + "countmax" => "The :attribute must have less than :max selected elements.", + "countmin" => "The :attribute must have at least :min selected elements.", "different" => "Полетата :attribute и :other трябва да са различни.", "email" => "Полето :attribute е с невалиден формат.", "exists" => "Избраната стойност на :attribute вече съществува.", diff --git a/application/language/de/validation.php b/application/language/de/validation.php index 87189410..80c3874e 100644 --- a/application/language/de/validation.php +++ b/application/language/de/validation.php @@ -24,6 +24,7 @@ "alpha" => ":attribute darf nur Buchstaben beinhalten.", "alpha_dash" => ":attribute sollte nur aus Buchstaben, Nummern und Bindestrichen bestehen.", "alpha_num" => ":attribute sollte nur aus Buchstaben und Nummern bestehen.", + "array" => "The :attribute must have selected elements.", "before" => ":attribute muss ein Datum vor dem :date sein.", "between" => array( "numeric" => ":attribute muss zwischen :min und :max liegen.", @@ -31,6 +32,10 @@ "string" => ":attribute muss zwischen :min und :max Zeichen lang sein.", ), "confirmed" => ":attribute stimmt nicht mit der Bestätigung überein.", + "count" => "The :attribute must have exactly :count selected elements.", + "countbetween" => "The :attribute must have between :min and :max selected elements.", + "countmax" => "The :attribute must have less than :max selected elements.", + "countmin" => "The :attribute must have at least :min selected elements.", "different" => ":attribute und :other müssen verschieden sein.", "email" => ":attribute ist keine gültige Email-Adresse.", "exists" => "Der gewählte Wert für :attribute ist ungültig.", diff --git a/application/language/en/validation.php b/application/language/en/validation.php index aade5eda..e5116996 100644 --- a/application/language/en/validation.php +++ b/application/language/en/validation.php @@ -24,6 +24,7 @@ "alpha" => "The :attribute may only contain letters.", "alpha_dash" => "The :attribute may only contain letters, numbers, and dashes.", "alpha_num" => "The :attribute may only contain letters and numbers.", + "array" => "The :attribute must have selected elements.", "before" => "The :attribute must be a date before :date.", "between" => array( "numeric" => "The :attribute must be between :min - :max.", @@ -31,6 +32,10 @@ "string" => "The :attribute must be between :min - :max characters.", ), "confirmed" => "The :attribute confirmation does not match.", + "count" => "The :attribute must have exactly :count selected elements.", + "countbetween" => "The :attribute must have between :min and :max selected elements.", + "countmax" => "The :attribute must have less than :max selected elements.", + "countmin" => "The :attribute must have at least :min selected elements.", "different" => "The :attribute and :other must be different.", "email" => "The :attribute format is invalid.", "exists" => "The selected :attribute is invalid.", diff --git a/application/language/fr/validation.php b/application/language/fr/validation.php index f5810be8..bbc0408f 100644 --- a/application/language/fr/validation.php +++ b/application/language/fr/validation.php @@ -24,6 +24,7 @@ "alpha" => "Le champ :attribute ne doit contenir que des lettres.", "alpha_dash" => "Le champ :attribute ne doit contenir que des lettres, nombres et des tirets.", "alpha_num" => "Le champ :attribute ne doit contenir que des lettres et nombres.", + "array" => "The :attribute must have selected elements.", "before" => "Le champ :attribute doit être une date avant :date.", "between" => array( "numeric" => "Le champ :attribute doit être entre :min - :max.", @@ -31,6 +32,10 @@ "string" => "Le champ :attribute doit être entre :min - :max caractères.", ), "confirmed" => "Le champ :attribute confirmation est différent.", + "count" => "The :attribute must have exactly :count selected elements.", + "countbetween" => "The :attribute must have between :min and :max selected elements.", + "countmax" => "The :attribute must have less than :max selected elements.", + "countmin" => "The :attribute must have at least :min selected elements.", "different" => "Les champ :attribute et :other doivent être différents.", "email" => "Le format du champ :attribute est invalide.", "exists" => "Le champ sélectionné :attribute est invalide.", diff --git a/application/language/he/validation.php b/application/language/he/validation.php index f0059b6a..f714dd8d 100644 --- a/application/language/he/validation.php +++ b/application/language/he/validation.php @@ -27,6 +27,7 @@ "alpha" => "הערך :attribute יכול להכיל רק אותיות.", "alpha_dash" => "הערך :attribute יכול להכיל רק אותיות, מספרים ומקפים.", "alpha_num" => "הערך :attribute יכול להכיל רק אותיות ומספרים.", + "array" => "The :attribute must have selected elements.", "before" => "הערך :attribute חייב להכיל תאריך לפני :date.", "between" => array( "numeric" => "הערך :attribute חייב להיות בין :min ל-:max.", @@ -34,6 +35,10 @@ "string" => "הערך :attribute חייב להכיל בין :min ל-:max תווים.", ), "confirmed" => "הערכים של :attribute חייבים להיות זהים.", + "count" => "The :attribute must have exactly :count selected elements.", + "countbetween" => "The :attribute must have between :min and :max selected elements.", + "countmax" => "The :attribute must have less than :max selected elements.", + "countmin" => "The :attribute must have at least :min selected elements.", "different" => "הערכים של :attribute ו-:other חייבים להיות שונים.", "email" => "הערך :attribute חייב להכיל כתובת אימייל תקינה.", "exists" => "הערך :attribute לא קיים.", diff --git a/application/language/hu/validation.php b/application/language/hu/validation.php index 30b2a0ca..ee0e7145 100644 --- a/application/language/hu/validation.php +++ b/application/language/hu/validation.php @@ -24,6 +24,7 @@ "alpha" => "A(z) :attribute csak betűket tartalmazhat.", "alpha_dash" => "A(z) :attribute betűket, számokat és kötőjeleket tartalmazhat.", "alpha_num" => "A(z) :attribute csak betűket és számokat tartalmazhat.", + "array" => "The :attribute must have selected elements.", "before" => "A :attribute :date előtti dátum kell legyen.", "between" => array( "numeric" => "A(z) :attribute :min - :max közötti érték kell legyen.", @@ -31,6 +32,10 @@ "string" => "A(z) :attribute :min - :max karakterhossz között kell legyen", ), "confirmed" => "A(z) :attribute megerősítése nem egyezett meg.", + "count" => "The :attribute must have exactly :count selected elements.", + "countbetween" => "The :attribute must have between :min and :max selected elements.", + "countmax" => "The :attribute must have less than :max selected elements.", + "countmin" => "The :attribute must have at least :min selected elements.", "different" => "A(z) :attribute és :other különböző kell legyen.", "email" => "A(z) :attribute formátuma nem megfelelő.", "exists" => "A(z) választott :attribute nem megfelelő.", diff --git a/application/language/id/validation.php b/application/language/id/validation.php index 3eafa4cc..51d0178e 100644 --- a/application/language/id/validation.php +++ b/application/language/id/validation.php @@ -24,6 +24,7 @@ "alpha" => "Isian :attribute hanya boleh berisi huruf.", "alpha_dash" => "Isian :attribute hanya boleh berisi huruf, angka, dan strip.", "alpha_num" => "Isian :attribute hanya boleh berisi huruf dan angka.", + "array" => "The :attribute must have selected elements.", "before" => "Isian :attribute harus tanggal sebelum :date.", "between" => array( "numeric" => "Isian :attribute harus antara :min - :max.", @@ -31,6 +32,10 @@ "string" => "Isian :attribute harus antara :min - :max karakter.", ), "confirmed" => "Konfirmasi :attribute tidak cocok.", + "count" => "The :attribute must have exactly :count selected elements.", + "countbetween" => "The :attribute must have between :min and :max selected elements.", + "countmax" => "The :attribute must have less than :max selected elements.", + "countmin" => "The :attribute must have at least :min selected elements.", "different" => "Isian :attribute dan :other harus berbeda.", "email" => "Format isian :attribute tidak valid.", "exists" => "Isian :attribute yang dipilih tidak valid.", diff --git a/application/language/ja/validation.php b/application/language/ja/validation.php index 45e3208b..19d5a1b3 100644 --- a/application/language/ja/validation.php +++ b/application/language/ja/validation.php @@ -40,6 +40,7 @@ "alpha" => ":attributeはアルファベッドのみがご利用できます。", "alpha_dash" => ":attributeは英数字とダッシュ(-)及び下線(_)がご利用できます。", "alpha_num" => ":attributeは英数字がご利用できます。", + "array" => "The :attribute must have selected elements.", "before" => ":attributeには、:date以前の日付をご利用ください。", "between" => array( "numeric" => ":attributeは、:minから、:maxまでの数字をご指定ください。", @@ -47,6 +48,10 @@ "string" => ":attributeは、:min文字から:max文字の間でご指定ください。", ), "confirmed" => ":attributeと、確認フィールドとが、一致していません。", + "count" => "The :attribute must have exactly :count selected elements.", + "countbetween" => "The :attribute must have between :min and :max selected elements.", + "countmax" => "The :attribute must have less than :max selected elements.", + "countmin" => "The :attribute must have at least :min selected elements.", "different" => ":attributeと:otherには、異なった内容を指定してください。", "email" => ":attributeには正しいメールアドレスの形式をご指定ください。", "exists" => "選択された:attributeは正しくありません。", diff --git a/application/language/nl/validation.php b/application/language/nl/validation.php index a604e034..ac0c8416 100644 --- a/application/language/nl/validation.php +++ b/application/language/nl/validation.php @@ -15,6 +15,7 @@ "alpha" => "Het :attribute mag alleen letters bevatten.", "alpha_dash" => "Het :attribute mag alleen letters, nummers, onderstreep(_) en strepen(-) bevatten.", "alpha_num" => "Het :attribute mag alleen letters en nummers", + "array" => "The :attribute must have selected elements.", "before" => "Het :attribute moet een datum voor :date zijn.", "between" => array( "numeric" => "Het :attribute moet tussen :min en :max zijn.", @@ -22,6 +23,10 @@ "string" => "Het :attribute moet tussen :min en :max tekens zijn.", ), "confirmed" => "Het :attribute bevestiging komt niet overeen.", + "count" => "The :attribute must have exactly :count selected elements.", + "countbetween" => "The :attribute must have between :min and :max selected elements.", + "countmax" => "The :attribute must have less than :max selected elements.", + "countmin" => "The :attribute must have at least :min selected elements.", "different" => "Het :attribute en :other moeten verschillend zijn.", "email" => "Het :attribute formaat is ongeldig.", "exists" => "Het gekozen :attribute is al ingebruik.", diff --git a/application/language/pl/validation.php b/application/language/pl/validation.php index ead856b1..65d8553a 100644 --- a/application/language/pl/validation.php +++ b/application/language/pl/validation.php @@ -2,98 +2,103 @@ return array( - /* - |-------------------------------------------------------------------------- - | Validation Language Lines - |-------------------------------------------------------------------------- - | - | The following language lines contain the default error messages used - | by the validator class. Some of the rules contain multiple versions, - | such as the size (max, min, between) rules. These versions are used - | for different input types such as strings and files. - | - | These language lines may be easily changed to provide custom error - | messages in your application. Error messages for custom validation - | rules may also be added to this file. - | - */ + /* + |-------------------------------------------------------------------------- + | Validation Language Lines + |-------------------------------------------------------------------------- + | + | The following language lines contain the default error messages used + | by the validator class. Some of the rules contain multiple versions, + | such as the size (max, min, between) rules. These versions are used + | for different input types such as strings and files. + | + | These language lines may be easily changed to provide custom error + | messages in your application. Error messages for custom validation + | rules may also be added to this file. + | + */ - "accepted" => ":attribute musi zostać zaakceptowane.", - "active_url" => ":attribute nie jest prawidłowym adresem URL.", - "after" => ":attribute musi zawierać datę, która jest po :date.", - "alpha" => ":attribute może zawierać jedynie litery.", - "alpha_dash" => ":attribute może zawierać jedynie litery, cyfry i myślniki.", - "alpha_num" => ":attribute może zawierać jedynie litery i cyfry.", - "before" => ":attribute musi zawierać datę, która jest przed :date.", - "between" => array( - "numeric" => ":ttribute musi mieścić się w granicach :min - :max.", - "file" => ":attribute musi mieć :min - :max kilobajtów.", - "string" => ":attribute musi mieć :min - :max znaków.", - ), - "confirmed" => "Potwierdzenie :attribute się nie zgadza.", - "different" => ":attribute i :other muszą się od siebie różnić.", - "email" => "The :attribute format is invalid.", - "exists" => "Zaznaczona opcja :attribute jest nieprawidłowa.", - "image" => ":attribute musi być obrazkiem.", - "in" => "Zaznaczona opcja :attribute jest nieprawidłowa.", - "integer" => ":attribute musi być liczbą całkowitą.", - "ip" => ":attribute musi być prawidłowym adresem IP.", - "match" => "Format :attribute jest nieprawidłowy.", - "max" => array( - "numeric" => ":attribute musi być poniżej :max.", - "file" => ":attribute musi mieć poniżej :max kilobajtów.", - "string" => ":attribute musi mieć poniżej :max znaków.", - ), - "mimes" => ":attribute musi być plikiem rodzaju :values.", - "min" => array( - "numeric" => ":attribute musi być co najmniej :min.", - "file" => "Plik :attribute musi mieć co najmniej :min kilobajtów.", - "string" => ":attribute musi mieć co najmniej :min znaków.", - ), - "not_in" => "Zaznaczona opcja :attribute jest nieprawidłowa.", - "numeric" => ":attribute musi być numeryczne.", - "required" => "Pole :attribute jest wymagane.", - "same" => ":attribute i :other muszą być takie same.", - "size" => array( - "numeric" => ":attribute musi mieć rozmiary :size.", - "file" => ":attribute musi mieć :size kilobajtów.", - "string" => ":attribute musi mieć :size znaków.", - ), - "unique" => ":attribute zostało już użyte.", - "url" => "Format pola :attribute jest nieprawidłowy.", + "accepted" => ":attribute musi zostać zaakceptowane.", + "active_url" => ":attribute nie jest prawidłowym adresem URL.", + "after" => ":attribute musi zawierać datę, która jest po :date.", + "alpha" => ":attribute może zawierać jedynie litery.", + "alpha_dash" => ":attribute może zawierać jedynie litery, cyfry i myślniki.", + "alpha_num" => ":attribute może zawierać jedynie litery i cyfry.", + "array" => "The :attribute must have selected elements.", + "before" => ":attribute musi zawierać datę, która jest przed :date.", + "between" => array( + "numeric" => ":ttribute musi mieścić się w granicach :min - :max.", + "file" => ":attribute musi mieć :min - :max kilobajtów.", + "string" => ":attribute musi mieć :min - :max znaków.", + ), + "confirmed" => "Potwierdzenie :attribute się nie zgadza.", + "count" => "The :attribute must have exactly :count selected elements.", + "countbetween" => "The :attribute must have between :min and :max selected elements.", + "countmax" => "The :attribute must have less than :max selected elements.", + "countmin" => "The :attribute must have at least :min selected elements.", + "different" => ":attribute i :other muszą się od siebie różnić.", + "email" => "The :attribute format is invalid.", + "exists" => "Zaznaczona opcja :attribute jest nieprawidłowa.", + "image" => ":attribute musi być obrazkiem.", + "in" => "Zaznaczona opcja :attribute jest nieprawidłowa.", + "integer" => ":attribute musi być liczbą całkowitą.", + "ip" => ":attribute musi być prawidłowym adresem IP.", + "match" => "Format :attribute jest nieprawidłowy.", + "max" => array( + "numeric" => ":attribute musi być poniżej :max.", + "file" => ":attribute musi mieć poniżej :max kilobajtów.", + "string" => ":attribute musi mieć poniżej :max znaków.", + ), + "mimes" => ":attribute musi być plikiem rodzaju :values.", + "min" => array( + "numeric" => ":attribute musi być co najmniej :min.", + "file" => "Plik :attribute musi mieć co najmniej :min kilobajtów.", + "string" => ":attribute musi mieć co najmniej :min znaków.", + ), + "not_in" => "Zaznaczona opcja :attribute jest nieprawidłowa.", + "numeric" => ":attribute musi być numeryczne.", + "required" => "Pole :attribute jest wymagane.", + "same" => ":attribute i :other muszą być takie same.", + "size" => array( + "numeric" => ":attribute musi mieć rozmiary :size.", + "file" => ":attribute musi mieć :size kilobajtów.", + "string" => ":attribute musi mieć :size znaków.", + ), + "unique" => ":attribute zostało już użyte.", + "url" => "Format pola :attribute jest nieprawidłowy.", - /* - |-------------------------------------------------------------------------- - | Custom Validation Language Lines - |-------------------------------------------------------------------------- - | - | Here you may specify custom validation messages for attributes using the - | convention "attribute_rule" to name the lines. This helps keep your - | custom validation clean and tidy. - | - | So, say you want to use a custom validation message when validating that - | the "email" attribute is unique. Just add "email_unique" to this array - | with your custom message. The Validator will handle the rest! - | - */ + /* + |-------------------------------------------------------------------------- + | Custom Validation Language Lines + |-------------------------------------------------------------------------- + | + | Here you may specify custom validation messages for attributes using the + | convention "attribute_rule" to name the lines. This helps keep your + | custom validation clean and tidy. + | + | So, say you want to use a custom validation message when validating that + | the "email" attribute is unique. Just add "email_unique" to this array + | with your custom message. The Validator will handle the rest! + | + */ - 'custom' => array(), + 'custom' => array(), - /* - |-------------------------------------------------------------------------- - | Validation Attributes - |-------------------------------------------------------------------------- - | - | The following language lines are used to swap attribute place-holders - | with something more reader friendly such as "E-Mail Address" instead - | of "email". Your users will thank you. - | - | The Validator class will automatically search this array of lines it - | is attempting to replace the :attribute place-holder in messages. - | It's pretty slick. We think you'll like it. - | - */ + /* + |-------------------------------------------------------------------------- + | Validation Attributes + |-------------------------------------------------------------------------- + | + | The following language lines are used to swap attribute place-holders + | with something more reader friendly such as "E-Mail Address" instead + | of "email". Your users will thank you. + | + | The Validator class will automatically search this array of lines it + | is attempting to replace the :attribute place-holder in messages. + | It's pretty slick. We think you'll like it. + | + */ - 'attributes' => array(), + 'attributes' => array(), ); \ No newline at end of file diff --git a/application/language/ru/validation.php b/application/language/ru/validation.php index e8ee3a13..8fd15f5c 100644 --- a/application/language/ru/validation.php +++ b/application/language/ru/validation.php @@ -24,6 +24,7 @@ "alpha" => "Поле :attribute может содержать только буквы.", "alpha_dash" => "Поле :attribute может содержать только буквы, цифры и тире.", "alpha_num" => "Поле :attribute может содержать только буквы и цифры.", + "array" => "The :attribute must have selected elements.", "before" => "Поле :attribute должно быть датой перед :date.", "between" => array( "numeric" => "Поле :attribute должно быть между :min и :max.", @@ -31,6 +32,10 @@ "string" => "Поле :attribute должно быть от :min до :max символов.", ), "confirmed" => "Поле :attribute не совпадает с подтверждением.", + "count" => "The :attribute must have exactly :count selected elements.", + "countbetween" => "The :attribute must have between :min and :max selected elements.", + "countmax" => "The :attribute must have less than :max selected elements.", + "countmin" => "The :attribute must have at least :min selected elements.", "different" => "Поля :attribute и :other должны различаться.", "email" => "Поле :attribute имеет неверный формат.", "exists" => "Выбранное значение для :attribute уже существует.", diff --git a/laravel/validator.php b/laravel/validator.php index e32c4ccc..556b116e 100644 --- a/laravel/validator.php +++ b/laravel/validator.php @@ -667,6 +667,70 @@ protected function validate_mimes($attribute, $value, $parameters) return false; } + /** + * Validate that an attribute is an array + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validate_array($attribute, $value) + { + return is_array($value); + } + + /** + * Validate that an attribute of type array has a specific count + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validate_count($attribute, $value, $parameters) + { + return (is_array($value) && count($value) == $parameters); + } + + /** + * Validate that an attribute of type array has a minimum of elements. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validate_countmin($attribute, $value, $parameters) + { + return (is_array($value) && count($value) >= $parameters); + } + + /** + * Validate that an attribute of type array has a maximum of elements. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validate_countmax($attribute, $value, $parameters) + { + return (is_array($value) && count($value) <= $parameters); + } + + /** + * Validate that an attribute of type array has elements between max and min. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validate_countbetween($attribute, $value, $parameters) + { + return (is_array($value) && count($value) >= $parameters[0] && count($value) <= $parameters[1] ); + } + /** * Validate the date is before a given date. * @@ -952,6 +1016,62 @@ protected function replace_after($message, $attribute, $rule, $parameters) return str_replace(':date', $parameters[0], $message); } + /** + * Replace all place-holders for the count rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replace_count($message, $attribute, $rule, $parameters) + { + return str_replace(':count', $parameters, $message); + } + + /** + * Replace all place-holders for the countmin rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replace_countmin($message, $attribute, $rule, $parameters) + { + return str_replace(':min', $parameters, $message); + } + + /** + * Replace all place-holders for the countmax rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replace_countmax($message, $attribute, $rule, $parameters) + { + return str_replace(':max', $parameters, $message); + } + + /** + * Replace all place-holders for the between rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replace_countbetween($message, $attribute, $rule, $parameters) + { + return str_replace(array(':min', ':max'), $parameters, $message); + } + /** * Get the displayable name for a given attribute. *