diff --git a/packages/tables/src/Columns/Concerns/InteractsWithTableQuery.php b/packages/tables/src/Columns/Concerns/InteractsWithTableQuery.php index 8c84fb794c..626fd6dfef 100644 --- a/packages/tables/src/Columns/Concerns/InteractsWithTableQuery.php +++ b/packages/tables/src/Columns/Concerns/InteractsWithTableQuery.php @@ -155,7 +155,7 @@ protected function getSortColumnForQuery(EloquentBuilder $query, string $sortCol if (! $relationship) { // Treat the missing "relationship" as a JSON column if dot notation is used in the column name. - return (string) str($relationshipName) + return (string) str($relationshipName ?? $this->getRelationshipName()) ->append('.') ->append($sortColumn) ->replace('.', '->');