Skip to content

Commit 1a53189

Browse files
committed
fix: prevent ambiguous column names
1 parent 9e6b686 commit 1a53189

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/EloquentDataTable.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ protected function isMorphRelation($relation)
155155
}
156156

157157
/**
158-
* Resolve the proper column name be used.
158+
* Resolve the proper column name to be used.
159159
*
160160
*
161161
* @throws \Yajra\DataTables\Exceptions\Exception
@@ -166,7 +166,9 @@ protected function resolveRelationColumn(string $column): string
166166
$columnName = array_pop($parts);
167167
$relation = str_replace('[]', '', implode('.', $parts));
168168

169-
if ($this->isNotEagerLoaded($relation)) {
169+
if (! $relation) {
170+
return $this->query->getModel()->getTable().'.'.$column;
171+
} elseif ($this->isNotEagerLoaded($relation)) {
170172
return $column;
171173
}
172174

0 commit comments

Comments
 (0)