Skip to content

Commit

Permalink
Fix case sort when key is string
Browse files Browse the repository at this point in the history
  • Loading branch information
luilliarcec committed Oct 24, 2024
1 parent b1c0707 commit fbc4de1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Sorts/CaseSort.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ protected function getQueryExpression(string $column): string
{
$sql = 'case ';
foreach ($this->cases as $key => $value) {
if (is_string($key)) {
$sql .= "when {$column} = '{$key}' then '{$value}' ";

continue;
}

$sql .= "when {$column} = {$key} then '{$value}' ";
}
$sql .= 'end ';
Expand Down

0 comments on commit fbc4de1

Please sign in to comment.