Proposed fix for hasOne not working in Relation field type

This commit is contained in:
Sam Georges 2014-11-04 12:34:45 +11:00
parent 7357954c84
commit d2547d1891

View File

@ -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;
}