/** * Return label string * * @param string $key * @return string */ public function getLabel($key) { $key = Str::toUpper($key); if (!$this->fields->has($key)) { throw new \InvalidArgumentException("Field `{$key}` is not exists"); } return $this->fields->get($key)->getlabel(); }
/** * Add error * @param string $key * @param string $message * @param array $params */ public function addError($key, $message, $params = []) { if ($this->error === null) { $this->error = new MessageBag(); } $this->error->add(Str::toUpper($key), !empty($params) ? strtr($message, $params) : $message); }