*/ public function toArray($request) { $attributes = collect([]); foreach ($this->form->getFields() as $field) { $attributes = $attributes->merge(Field::fromConfig($field)->presentValue($this->data[$field['key']])); } return $attributes->toArray(); } /** * @return array */ public static function meta(Form $form): array { return [ 'active_columns' => $form->active_columns, 'columns' => $form->getFields() ->map(fn ($field) => Field::fromConfig($field)) ->map(fn ($field) => [ 'name' => $field->name, 'base_type' => class_basename($field), 'id' => $field->key, 'display_attribute' => $field->getdisplayAttribute(), ]) ]; } }