max) and !($length >= $this->min && $length <= $this->max)) { $fail(trans('validation.between.string', [ 'attribute' => $translatedAttribute, 'min' => $this->min, 'max' => $this->max ])); return; } if ($length < $this->min) { $fail(trans('validation.min.string', [ 'attribute' => $translatedAttribute, 'min' => $this->min ])); } } /** * Get the correct translation for the given attrribute. * * @param string $attribute * @return string */ private static function getTranslatedAttribute(string $attribute): string { /** @var \Illuminate\Translation\Translator $trans */ $trans = trans(); if ($trans->has('validation.attributes.' . $attribute)) { return trans('validation.attributes.' . $attribute); } if ($trans->has('validation.custom.' . $attribute)) { return trans('validation.custom.' . $attribute); } return $attribute; } }