/** * Get the displayable name for a given attribute. * * @param string $attribute * @return string */ protected function attribute($attribute) { $bundle = Bundle::prefix($this->bundle); // More reader friendly versions of the attribute names may be stored // in the validation language file, allowing a more readable version // of the attribute name in the message. $line = "{$bundle}validation.attributes.{$attribute}"; if (Lang::has($line, $this->language)) { return Lang::line($line)->get($this->language); } else { return str_replace('_', ' ', $attribute); } }
/** * Get the proper error message for an attribute and rule. * * @param string $attribute * @param string $rule * @return string */ protected function message($attribute, $rule) { $bundle = Bundle::prefix($this->bundle); // First we'll check for developer specified, attribute specific messages. // These messages take first priority. They allow the fine-grained tuning // of error messages for each rule. $custom = $attribute . '_' . $rule; if (array_key_exists($custom, $this->messages)) { return $this->messages[$custom]; } elseif (Lang::has($custom = "validation.custom.{$custom}", $this->language)) { return Lang::line($custom)->get($this->language); } elseif (array_key_exists($rule, $this->messages)) { return $this->messages[$rule]; } elseif (in_array($rule, $this->size_rules)) { return $this->size_message($bundle, $attribute, $rule); } else { $line = "{$bundle}validation.{$rule}"; return Lang::line($line)->get($this->language); } }
protected function attribute($attribute) { $bundle = Bundle::prefix($this->bundle); $line = "{$bundle}validation.attributes.{$attribute}"; if (Lang::has($line, $this->language)) { return Lang::line($line)->get($this->language); } else { return str_replace('_', ' ', $attribute); } }