/** * Reads the first Message from ViewErrorBag if existent * @param ViewErrorBag $errors * @param string $key * @return bool|string */ private function getFirstErrorMessage(ViewErrorBag $errors, $key) { if ($errors->has($key)) { return $errors->first($key); } return false; }
/** * @param $name * @return array */ protected function getErrorClass($name) { $class = []; if ($this->errors->has($name)) { $class[] = 'has-error'; } return $class; }
/** * Returns field label * * @param bool $showLabel * @param array $options * @param string $name * @param ViewErrorBag $errors * @return string */ public function fieldLabel($showLabel, array $options, $name, ViewErrorBag $errors) { if ($showLabel && !(isset($options['label']) && $options['label'] === false)) { $class = isset($options['label_attr']['class']) ? $options['label_attr']['class'] : ''; $options['label_attr']['class'] = 'form-group__label ' . ($errors->has($name) ? ' form-group__label--error ' : '') . $class; return \Form::label($name, trans()->has('validation.attributes.' . $name) ? trans('validation.attributes.' . $name) : trans($options['label']), $options['label_attr']); } return ''; }