mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Proposed fix for hasOne not working in Relation field type
This commit is contained in:
parent
7357954c84
commit
d2547d1891
@ -108,9 +108,10 @@ class Relation extends FormWidgetBase
|
||||
$relatedObj = $model->makeRelation($attribute);
|
||||
$query = $model->{$attribute}()->newQuery();
|
||||
|
||||
if (in_array($this->relationType, ['belongsToMany', 'morphToMany', 'morphedByMany'])) {
|
||||
if (in_array($this->relationType, ['belongsToMany', 'morphToMany', 'morphedByMany', 'hasMany'])) {
|
||||
$field->type = 'checkboxlist';
|
||||
} elseif ($this->relationType == 'belongsTo') {
|
||||
}
|
||||
elseif (in_array($this->relationType, ['belongsTo', 'hasOne'])) {
|
||||
$field->type = 'dropdown';
|
||||
$field->placeholder = $this->emptyOption;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user