Ejemplo n.º 1
0
 /**
  * Build the builder.
  *
  * @return FormBuilder
  */
 public function build()
 {
     /*
      * Hide breadcrumbs by default.
      */
     array_set($this->parameters, 'options.breadcrumb', array_get($this->parameters, 'options.breadcrumb', false));
     /*
      * Cache and hash!
      */
     array_set($this->parameters, 'key', md5(json_encode($this->parameters)));
     /*
      * Set the forms URL after obtaining
      * our parameter hash for the form.
      */
     array_set($this->parameters, 'options.url', array_get($this->parameters, 'options.url', $this->builder->getOption('url', 'form/handle/' . array_get($this->parameters, 'key'))));
     $this->cache->remember('form::' . array_get($this->parameters, 'key'), 30, function () {
         return $this->parameters;
     });
     if (is_array(array_get($this->parameters, 'options'))) {
         foreach (array_pull($this->parameters, 'options') as $key => $value) {
             $this->builder->setOption($key, $value);
         }
     }
     return $this->hydrator->hydrate($this->builder, $this->parameters);
 }