diff --git a/src/generators/crud/providers/core/RelationProvider.php b/src/generators/crud/providers/core/RelationProvider.php index 97ac2aff..68272c17 100644 --- a/src/generators/crud/providers/core/RelationProvider.php +++ b/src/generators/crud/providers/core/RelationProvider.php @@ -54,7 +54,7 @@ public function activeField($attribute) if (is_string($column)) { return null; } - $relation = $this->generator->getRelationByColumn($this->generator->modelClass, $column, ['belongs_to']); + $relation = $this->generator->getRelationByColumn($this->generator->modelClass, $column, ['belongs_to', 'has_one']); if ($relation) { switch (true) { case !$relation->multiple: @@ -128,7 +128,7 @@ public function attributeFormat($attribute) //return null; #TODO: double check with primary keys not named `id` of non-pivot tables } - $relation = $this->generator->getRelationByColumn($this->generator->modelClass, $column, ['belongs_to']); + $relation = $this->generator->getRelationByColumn($this->generator->modelClass, $column, ['belongs_to', 'has_one']); if ($relation) { if ($relation->multiple) { return; @@ -204,7 +204,7 @@ public function columnFormat($attribute, $model) //return null; } - $relation = $this->generator->getRelationByColumn($model, $column, ['belongs_to']); + $relation = $this->generator->getRelationByColumn($model, $column, ['belongs_to', 'has_one']); if ($relation) { if ($relation->multiple) { return;