Skip to content

Commit

Permalink
Fix binding on searchableRaw
Browse files Browse the repository at this point in the history
  • Loading branch information
dansysanalyst committed May 27, 2024
1 parent 71ba833 commit fe82057
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DataSource/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function filterContains(): Builder

$query->when($search != '', function () use ($column, $query, $search, $table, $field, $hasColumn) {
if (($sqlRaw = strval(data_get($column, 'searchableRaw')))) {
$query->orWhereRaw($sqlRaw . ' ' . Sql::like($query) . ' \'%' . $search . '%\'');
$query->orWhereRaw($sqlRaw . ' ' . Sql::like($query) . ' ?', ["%{$search}%"]);
}

if ($hasColumn && blank(data_get($column, 'searchableRaw'))) {
Expand All @@ -164,7 +164,7 @@ public function filterContains(): Builder
$driverName = $query->getConnection()->getConfig('driver');

if ($columnType === 'json' && strtolower($driverName) !== 'pgsql') {
$query->orWhereRaw("LOWER(`{$table}`.`{$field}`)" . Sql::like($query) . "?", '%' . $search . '%');
$query->orWhereRaw("LOWER(`{$table}`.`{$field}`)" . Sql::like($query) . ' ?', ["%{$search}%"]);
} else {
$query->orWhere("{$table}.{$field}", Sql::like($query), "%{$search}%");
}
Expand Down

0 comments on commit fe82057

Please sign in to comment.