Commit a7c2c254 authored by Dayle Rees's avatar Dayle Rees

Merge pull request #1053 from tobsn/patch-12

added array and array count validation for multi-select input
parents 4b8ba992 43c3c2de
......@@ -24,6 +24,7 @@ return array(
"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 @@ return array(
"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 غير موجودة.",
......
......@@ -24,6 +24,7 @@ return array(
"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 @@ return array(
"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 вече съществува.",
......
......@@ -24,6 +24,7 @@ return array(
"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 @@ return array(
"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.",
......
......@@ -24,6 +24,7 @@ return array(
"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 @@ return array(
"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.",
......
......@@ -24,6 +24,7 @@ return array(
"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 @@ return array(
"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.",
......
......@@ -27,6 +27,7 @@ return array(
"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 @@ return array(
"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 לא קיים.",
......
......@@ -24,6 +24,7 @@ return array(
"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 @@ return array(
"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ő.",
......
......@@ -24,6 +24,7 @@ return array(
"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 @@ return array(
"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.",
......
......@@ -40,6 +40,7 @@ return array(
"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 @@ return array(
"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は正しくありません。",
......
......@@ -15,6 +15,7 @@ return array(
"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 @@ return array(
"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.",
......
......@@ -24,6 +24,7 @@ return array(
"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.",
......@@ -31,6 +32,10 @@ return array(
"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.",
......
......@@ -24,6 +24,7 @@ return array(
"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 @@ return array(
"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 уже существует.",
......
......@@ -668,6 +668,70 @@ class Validator {
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[0]);
}
/**
* 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[0]);
}
/**
* 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[0]);
}
/**
* 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.
*
......@@ -953,6 +1017,62 @@ class Validator {
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[0], $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[0], $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[0], $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.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment