Skip to content

Commit

Permalink
Fixed a bug in custom select statement inclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
wasxxm committed Mar 7, 2022
1 parent 50c71f7 commit 6b2b79d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/ColumnSortable/Sortable.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,11 @@ private function formJoin(
{
$joinType = config('columnsortable.join_type', 'leftJoin');

$query->select($parentTable . '.*')
->{$joinType}($relatedTable, $parentPrimaryKey, '=', $relatedPrimaryKey);
if ($query->getQuery()->columns === null) {
$query->select($parentTable.'.*');
}

$query->{$joinType}($relatedTable, $parentPrimaryKey, '=', $relatedPrimaryKey);

if ($sub1RelatedTable) {
$query->{$joinType}($sub1RelatedTable, $sub1RelatedParentPrimaryKey, '=', $sub1RelatedPrimaryKey);
Expand Down

0 comments on commit 6b2b79d

Please sign in to comment.