public function preSet(FormEvent $event) { $form = $event->getForm(); $rootName = $form->getRoot()->getName(); if (!$form->isRoot() && ($parent = $form->getParent())) { $name = $this->getDottedName($form); $fullName = $this->getFullName($rootName, $name); // Add input from the previous submit if ($form->getName() !== '_token' && $this->session->hasOldInput($fullName)) { // Get old value $value = $this->session->getOldInput($fullName); // Transform back to good data $value = $this->transformValue($event, $value); // Store on the form $event->setData($value); } if ($this->session->has('errors')) { /** @var \Illuminate\Support\ViewErrorBag $errors */ $errors = $this->session->get('errors'); if ($errors->has($name)) { $form->addError(new FormError(implode(' ', $errors->get($name)))); } } } }