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('hasMany field must be a HasMany relation.');
}
$grid = new Grid($relation->getRelated(), $this->builder);
$grid->build();
return parent::render()->with(['grid' => $grid]);
}