Exemplo n.º 1
0
 /**
  * Handle the command.
  *
  * @param Container $container
  */
 public function handle(Container $container)
 {
     /**
      * Set the default options handler based
      * on the builder class. Defaulting to
      * no handler.
      */
     if (!$this->builder->getRepository()) {
         $model = $this->builder->getFormModel();
         $form = $this->builder->getForm();
         $repository = str_replace('FormBuilder', 'FormRepository', get_class($this->builder));
         if (!$this->builder->getRepository() && class_exists($repository)) {
             $this->builder->setRepository($container->make($repository, compact('form', 'model')));
         } elseif (!$this->builder->getRepository() && $model instanceof EntryModel) {
             $this->builder->setRepository($container->make(EntryFormRepository::class, compact('form', 'model')));
         } elseif (!$this->builder->getRepository() && $model instanceof EloquentModel) {
             $this->builder->setRepository($container->make(EloquentFormRepository::class, compact('form', 'model')));
         }
     }
 }