*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'organisation_id' => $this->organisation_id, 'name' => $this->name, 'slug' => $this->slug, 'field_type' => $this->field_type, 'label' => $this->label, 'help_text' => $this->help_text, 'options' => $this->options, 'validation_rules' => app(FormFieldValidationRuleService::class)->toJsonShape( $this->resource->validationRules, ), 'configs' => app(FormFieldConfigService::class)->toJsonShape( $this->resource->configs, ), 'default_is_required' => (bool) $this->default_is_required, 'default_is_filterable' => (bool) $this->default_is_filterable, 'default_binding' => app(FormFieldBindingService::class)->toJsonShape( $this->resource->bindings->first(), ), 'translations' => $this->translations, 'description' => $this->description, 'usage_count' => (int) ($this->usage_count ?? 0), 'is_system' => (bool) $this->is_system, 'is_active' => (bool) $this->is_active, ]; } }