diff --git a/src/Illuminate/Translation/lang/en/validation.php b/src/Illuminate/Translation/lang/en/validation.php index 5dd4d3807aba..b6c7778129c1 100644 --- a/src/Illuminate/Translation/lang/en/validation.php +++ b/src/Illuminate/Translation/lang/en/validation.php @@ -68,8 +68,8 @@ 'numeric' => 'The :attribute field must be greater than or equal to :value.', 'string' => 'The :attribute field must be greater than or equal to :value characters.', ], - 'height' => 'The :attribute field must be :height pixels.', - 'height_between' => 'The :attribute field must be between :min_height and :max_height pixels in height.', + 'height' => 'The :attribute field must have a height of :value pixels', + 'height_between' => 'The :attribute field must have a height between :min and :max pixels.', 'hex_color' => 'The :attribute field must be a valid hexadecimal color.', 'image' => 'The :attribute field must be an image.', 'in' => 'The selected :attribute is invalid.', @@ -101,9 +101,9 @@ 'string' => 'The :attribute field must not be greater than :max characters.', ], 'max_digits' => 'The :attribute field must not have more than :max digits.', - 'max_height' => 'The :attribute field must not be greater than :max_height pixels.', - 'max_ratio' => 'The :attribute field must have maximum aspect ratio of :max_ratio.', - 'max_width' => 'The :attribute field must not be greater than :max_width pixels.', + 'max_height' => 'The :attribute field must have a maximum height of :max pixels.', + 'max_ratio' => 'The :attribute field must have an aspect ratio less than :max.', + 'max_width' => 'The :attribute field must have a maximum width of :max pixels.', 'mimes' => 'The :attribute field must be a file of type: :values.', 'mimetypes' => 'The :attribute field must be a file of type: :values.', 'min' => [ @@ -113,9 +113,9 @@ 'string' => 'The :attribute field must be at least :min characters.', ], 'min_digits' => 'The :attribute field must have at least :min digits.', - 'min_height' => 'The :attribute field must be at least :min_height pixels.', - 'min_ratio' => 'The :attribute field must have minimum aspect ratio of :min_ratio.', - 'min_width' => 'The :attribute field must be at least :min_width pixels.', + 'min_height' => 'The :attribute field must have a minimum height of :min pixels.', + 'min_ratio' => 'The :attribute field must have an aspect ratio greater than :min.', + 'min_width' => 'The :attribute field must have a minimum width of :min pixels.', 'missing' => 'The :attribute field must be missing.', 'missing_if' => 'The :attribute field must be missing when :other is :value.', 'missing_unless' => 'The :attribute field must be missing unless :other is :value.', @@ -141,8 +141,8 @@ 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.', 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.', 'prohibits' => 'The :attribute field prohibits :other from being present.', - 'ratio' => 'The :attribute field must have a :ratio aspect ratio.', - 'ratio_between' => 'The :attribute field must have an aspect ratio between :min_ratio and :max_ratio.', + 'ratio' => 'The :attribute field must have an aspect ratio of :value', + 'ratio_between' => 'The :attribute field must have an aspect ratio between :min and :max.', 'regex' => 'The :attribute field format is invalid.', 'required' => 'The :attribute field is required.', 'required_array_keys' => 'The :attribute field must contain entries for: :values.', @@ -170,8 +170,8 @@ 'url' => 'The :attribute field must be a valid URL.', 'ulid' => 'The :attribute field must be a valid ULID.', 'uuid' => 'The :attribute field must be a valid UUID.', - 'width' => 'The :attribute field must be :width pixels.', - 'width_between' => 'The :attribute field must be between :min_width and :max_width pixels in width.', + 'width' => 'The :attribute field must have a width of :value pixels', + 'width_between' => 'The :attribute field must have width between :min and :max pixels.', /* |-------------------------------------------------------------------------- | Custom Validation Language Lines diff --git a/src/Illuminate/Validation/Concerns/ReplacesAttributes.php b/src/Illuminate/Validation/Concerns/ReplacesAttributes.php index ac229f17d0b7..76afe2ee870e 100644 --- a/src/Illuminate/Validation/Concerns/ReplacesAttributes.php +++ b/src/Illuminate/Validation/Concerns/ReplacesAttributes.php @@ -811,103 +811,102 @@ protected function replaceDimensions($message, $attribute, $rule, $parameters) return $message; } - /** * Replace placeholder for the width constraint on the dimensions rule * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array$parameters + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters * @return string */ protected function replaceWidth($message, $attribute, $rule, $parameters) { - return str_replace(':width', $parameters[0], $message); + return str_replace(':value', $parameters[0], $message); } /** * Replace placeholder for the minimum width constraint on the dimensions rule * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array$parameters + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters * @return string */ protected function replaceMinWidth($message, $attribute, $rule, $parameters) { - return str_replace(':min_width', $parameters[0], $message); + return $this->replaceMin($message, $attribute, $rule, $parameters); } /** * Replace placeholder for the maximum width constraint on the dimensions rule * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array$parameters + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters * @return string */ protected function replaceMaxWidth($message, $attribute, $rule, $parameters) { - return str_replace(':max_width', $parameters[0], $message); + return $this->replaceMax($message, $attribute, $rule, $parameters); } /** * Replace placeholders for the width between constraint on the dimensions rule * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array$parameters + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters * @return string */ protected function replaceWidthBetween($message, $attribute, $rule, $parameters) { - return str_replace([':min_width', ':max_width'], $parameters, $message); + return $this->replaceBetween($message, $attribute, $rule, $parameters); } /** * Replace placeholder for the height constraint on the dimensions rule * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array$parameters + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters * @return string */ protected function replaceHeight($message, $attribute, $rule, $parameters) { - return str_replace(':height', $parameters[0], $message); + return str_replace(':value', $parameters[0], $message); } /** * Replace placeholder for the width between constraint on the dimensions rule * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array$parameters + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters * @return string */ protected function replaceMinHeight($message, $attribute, $rule, $parameters) { - return str_replace(':min_height', $parameters[0], $message); + return $this->replaceMin($message, $attribute, $rule, $parameters); } /** * Replace placeholder for the maximum height constraint on the dimensions rule * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array$parameters + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters * @return string */ protected function replaceMaxHeight($message, $attribute, $rule, $parameters) { - return str_replace(':max_height', $parameters[0], $message); + return $this->replaceMax($message, $attribute, $rule, $parameters); } /** @@ -921,63 +920,63 @@ protected function replaceMaxHeight($message, $attribute, $rule, $parameters) */ protected function replaceHeightBetween($message, $attribute, $rule, $parameters) { - return str_replace([':min_height', ':max_height'], $parameters, $message); + return $this->replaceBetween($message, $attribute, $rule, $parameters); } /** * Replace placeholder for the ratio constraint on the dimensions rule * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array$parameters + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters * @return string */ protected function replaceRatio($message, $attribute, $rule, $parameters) - { - return str_replace(':ratio', $parameters[0], $message); + {; + return str_replace(':value', round($parameters[0], 3), $message); } /** * Replace placeholder for the minimum ratio constraint on the dimensions rule * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array$parameters + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters * @return string */ protected function replaceMinRatio($message, $attribute, $rule, $parameters) { - return str_replace(':min_ratio', $parameters[0], $message); + return $this->replaceMin($message, $attribute, $rule, [round($parameters[0], 3)]); } /** * Replace placeholder for the maximum ratio constraint on the dimensions rule * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array$parameters + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters * @return string */ protected function replaceMaxRatio($message, $attribute, $rule, $parameters) { - return str_replace(':max_ratio', $parameters[0], $message); + return $this->replaceMax($message, $attribute, $rule, [round($parameters[0], 3)]); } /** * Replace placeholders for the ratio between constraint on the dimensions rule * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array$parameters + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters * @return string */ protected function replaceRatioBetween($message, $attribute, $rule, $parameters) { - return str_replace([':min_ratio', ':max_ratio'], $parameters, $message); + return $this->replaceBetween($message, $attribute, $rule, [round($parameters[0], 3), round($parameters[1], 3)]); } /**