Encore\Admin\Form::setFieldValue PHP Method

setFieldValue() protected method

Set all fields value in form.
protected setFieldValue ( $id ) : void
$id
return void
    protected function setFieldValue($id)
    {
        $relations = $this->getRelations();
        $this->model = $this->model->with($relations)->findOrFail($id);
        $data = $this->model->toArray();
        $this->builder->fields()->each(function (Field $field) use($data) {
            $field->fill($data);
        });
    }