/** * @return MessageBag */ private function oldInput() { if (!isset($this->oldInput)) { $this->oldInput = new MessageBag((array) $this->sessionStore->getOldInput()); } return $this->oldInput; }
/** * @return \Cocona\Core\Html\Elements\Form */ public function edit($id) { $form = $this->app->call([$this->resource, 'form']); // Create the route param from the name $param = str_replace('-', '_', snake_case($this->resource->name())); $form->action($this->to('update', [$param => $id])); // Spoof the form method and add the CSRF token $form->hidden('_method', 'PUT'); $form->token(); // Fill the form with the model and overwrite it with // the request if is available $form->fill($this->resource->item($id), $this->session->getOldInput()); return $form; }
/** * Get the value that should be assigned to the field. * * @param string $name * @param string $value * @return string */ public function getValueAttribute($name, $value = null) { if (is_null($name)) { return $value; } if (isset($this->session) and $this->session->hasOldInput($name)) { return $this->session->getOldInput($name); } if (!is_null($value)) { return $value; } if (isset($this->model) and isset($this->model[$name])) { return $this->getModelValueAttribute($name); } }
/** * Get the requested item from the flashed input array. * * @param string $key * @param mixed $default * @return mixed * @static */ public static function getOldInput($key = null, $default = null) { return \Illuminate\Session\Store::getOldInput($key, $default); }
/** * Determine if the old input is empty. * * @return bool */ public function oldInputIsEmpty() { return isset($this->session) && count($this->session->getOldInput()) == 0; }
/** * Get the value from old input. * * @param string $name * @return mixed|null */ protected function valueFromOld($name) { return $this->session->getOldInput($name); }