mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-13 17:14:10 -08:00
Be a little more explicit
This commit is contained in:
parent
7f3c86165b
commit
aec781e7df
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue