Skip to content

Commit

Permalink
Merge pull request #24 from ukfast/allow_null_sort_order_to_be_changed
Browse files Browse the repository at this point in the history
Remove quotes from function call
  • Loading branch information
Gman98ish authored Jun 29, 2022
2 parents d0dd552 + 9266a6f commit a1b69ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Sieve.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ public function apply($queryBuilder)
}

if ($this->getSort() == "$property:asc_nulls_last") {
$queryBuilder->orderByRaw("ISNULL(\"$column\") asc")
$queryBuilder->orderByRaw("ISNULL($column) asc")
->orderBy($column, 'asc');
}

if ($this->getSort() == "$property:desc_nulls_first") {
$queryBuilder->orderByRaw("ISNULL(\"$column\") desc")
$queryBuilder->orderByRaw("ISNULL($column) desc")
->orderBy($column, 'desc');
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/SieveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function applies_sieve_sorts_to_a_query_builder_asc_nulls_last()
$seive->apply($builder);

$this->assertEquals(
'select * from "pets" order by ISNULL("name") asc, "name" asc',
'select * from "pets" order by ISNULL(name) asc, "name" asc',
$builder->toSql()
);
}
Expand All @@ -117,7 +117,7 @@ public function applies_sieve_sorts_to_a_query_builder_desc_nulls_first()
$seive->apply($builder);

$this->assertEquals(
'select * from "pets" order by ISNULL("name") desc, "name" desc',
'select * from "pets" order by ISNULL(name) desc, "name" desc',
$builder->toSql()
);
}
Expand Down

0 comments on commit a1b69ce

Please sign in to comment.