Be a little more explicit

This commit is contained in:
Marcus Moore 2024-08-22 16:03:30 -07:00
parent 7f3c86165b
commit aec781e7df
No known key found for this signature in database

View file

@ -25,7 +25,7 @@ class CustomFieldSetDefaultValuesForModel extends Component
$this->add_default_values = ($this->model?->defaultValues->count() > 0); $this->add_default_values = ($this->model?->defaultValues->count() > 0);
$this->fields->each(function ($field) { $this->fields->each(function ($field) {
$this->setSelectedValueForField($field); $this->selectedValues[$field->db_column] = $this->getSelectedValueForField($field);
}); });
} }
@ -52,7 +52,7 @@ class CustomFieldSetDefaultValuesForModel extends Component
return view('livewire.custom-field-set-default-values-for-model'); return view('livewire.custom-field-set-default-values-for-model');
} }
private function setSelectedValueForField(CustomField $field): void private function getSelectedValueForField(CustomField $field)
{ {
$defaultValue = $field->defaultValue($this->model_id); $defaultValue = $field->defaultValue($this->model_id);
@ -71,6 +71,6 @@ class CustomFieldSetDefaultValuesForModel extends Component
$defaultValue = explode(', ', $defaultValue); $defaultValue = explode(', ', $defaultValue);
} }
$this->selectedValues[$field->db_column] = $defaultValue; return $defaultValue;
} }
} }