Fixes logic error in #233
This commit is contained in:
parent
9f30a25cf1
commit
8f007d100d
|
|
@ -91,7 +91,7 @@ class Relation extends FormWidgetBase
|
|||
$relatedObj = $this->model->makeRelation($this->relationName);
|
||||
$query = $relatedObj->newQuery();
|
||||
|
||||
if ($this->relationType == 'belongsToMany') {
|
||||
if (in_array($this->relationType, ['belongsToMany', 'morphToMany', 'morphedByMany'])) {
|
||||
$field->type = 'checkboxlist';
|
||||
$field->value = $relationObj->getRelatedIds();
|
||||
}
|
||||
|
|
@ -101,10 +101,6 @@ class Relation extends FormWidgetBase
|
|||
$foreignKey = $relationObj->getForeignKey();
|
||||
$field->value = $this->model->$foreignKey;
|
||||
}
|
||||
else if ($this->relationType == ('morphToMany' || 'morphedByMany')) {
|
||||
$field->type = 'checkboxlist';
|
||||
$field->value = $relationObj->getRelatedIds();
|
||||
}
|
||||
|
||||
// It is safe to assume that if the model and related model are of
|
||||
// the exact same class, then it cannot be related to itself
|
||||
|
|
|
|||
Loading…
Reference in New Issue