Skip to content

Commit 1a4959d

Browse files
committed
fix: fixing upper function for pgsql
1 parent 203167c commit 1a4959d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Filters/SearchableFilter.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,12 @@ public function filter(RestifyRequest $request, $query, $value)
4343

4444
if (! config('restify.search.case_sensitive')) {
4545
$upper = strtoupper($value);
46+
47+
$columnExpression = $connectionType === 'pgsql'
48+
? "UPPER({$this->column}::text)"
49+
: "UPPER({$this->column})";
4650

47-
return $query->orWhereRaw("UPPER({$this->column}) LIKE ?", ['%'.$upper.'%']);
51+
return $query->orWhereRaw("{$columnExpression} LIKE ?", ['%'.$upper.'%']);
4852
}
4953

5054
return $query->orWhere($this->column, $likeOperator, "%{$value}%");

0 commit comments

Comments
 (0)