@@ -37,10 +37,6 @@ trait CanMapDynamicFields
3737{
3838 private FieldInspector $ fieldInspector ;
3939
40- /**
41- * Maps field type strings to their corresponding field class implementations.
42- * Used as a fallback when custom fields are not available.
43- */
4440 private const FIELD_TYPE_MAP = [
4541 'text ' => Text::class,
4642 'textarea ' => Textarea::class,
@@ -57,19 +53,11 @@ trait CanMapDynamicFields
5753 'tags ' => Tags::class,
5854 ];
5955
60- /**
61- * Initialize the field inspector service.
62- * Called during the component's boot process.
63- */
6456 public function boot (): void
6557 {
6658 $ this ->fieldInspector = app (FieldInspector::class);
6759 }
6860
69- /**
70- * Handle field refresh events from Livewire.
71- * Currently a placeholder for future implementation.
72- */
7361 #[On('refreshFields ' )]
7462 public function refresh (): void
7563 {
@@ -129,32 +117,16 @@ protected function mutateBeforeSave(array $data): array
129117 });
130118 }
131119
132- /**
133- * Check if the current record exists and has fields.
134- *
135- * @return bool True if record exists and has fields
136- */
137120 private function hasValidRecordWithFields (): bool
138121 {
139122 return isset ($ this ->record ) && ! $ this ->record ->fields ->isEmpty ();
140123 }
141124
142- /**
143- * Check if the current record exists.
144- *
145- * @return bool True if record exists
146- */
147125 private function hasValidRecord (): bool
148126 {
149127 return isset ($ this ->record );
150128 }
151129
152- /**
153- * Extract form values from the data array.
154- *
155- * @param array $data The form data
156- * @return array The extracted values
157- */
158130 private function extractFormValues (array $ data ): array
159131 {
160132 return isset ($ data [$ this ->record ?->valueColumn]) ? $ data [$ this ->record ?->valueColumn] : [];
@@ -426,11 +398,6 @@ private function resolveFormFields(mixed $record = null, bool $isNested = false)
426398 ->all ();
427399 }
428400
429- /**
430- * Resolve custom field implementations.
431- *
432- * @return Collection Collection of custom field instances
433- */
434401 private function resolveCustomFields (): Collection
435402 {
436403 return collect (Fields::getFields ())
@@ -468,14 +435,6 @@ private function resolveFieldInput(Model $field, Collection $customFields, mixed
468435 return null ;
469436 }
470437
471- /**
472- * Generate the input name for a field.
473- *
474- * @param Model $field The field model
475- * @param mixed $record The record
476- * @param bool $isNested Whether this is a nested field
477- * @return string The input name
478- */
479438 private function generateInputName (Model $ field , mixed $ record , bool $ isNested ): string
480439 {
481440 return $ isNested ? "{$ field ->ulid }" : "{$ record ->valueColumn }. {$ field ->ulid }" ;
0 commit comments