class; if (session()->has('errors')) { $error = session('errors')[$this->name]; if ($error) { $class .= ' border-red'; } } else { $class .= ' border-black focus:border-black'; } $data = [ 'id' => $this->id, 'name' => $this->name, 'class' => $class, 'type' => $this->type, ]; if ($this->required) { $data['required'] = 'required'; } return form_input($data, old($this->name, $this->value)); } }