public function checkPersonalInformation() { $rules = $this->getAllRules(); $this->validate($this->borrower->getPersonalInformation(), $rules); $messages = $this->getMessageBag()->getMessages(); $fields = array_combine(array_keys($rules), array_fill(0, count($rules), false)); foreach ($messages as $field => $error) { $fields[$field] = true; preg_match('/^(?P<contact>.*_)(firstName|lastName)$/', $field, $matches); if ($matches) { $fields[$matches['contact'] . 'firstName'] = true; $fields[$matches['contact'] . 'lastName'] = true; } } if ($this->borrower->getActivationStatus() == 'pending') { $this->fields = array_combine(array_keys($rules), array_fill(0, count($rules), true)); } else { $this->fields = $fields; } }