Пример #1
0
 public function render()
 {
     if ($this->form->builder()->isMode('create')) {
         return;
     }
     $model = $this->form->model();
     $relation = call_user_func([$model, $this->relationName]);
     if (!$relation instanceof Relation) {
         throw new \Exception('embedsMany field must be a EmbedsMany relation.');
     }
     $form = new Form($relation->getRelated(), $this->builder);
     $form->build();
     return parent::render()->with(['form' => $form->builder()])->render();
 }