Skip to content

Commit

Permalink
Merge pull request #35 from eddy8/9.x
Browse files Browse the repository at this point in the history
9.x
  • Loading branch information
eddy8 authored Jul 23, 2024
2 parents e2fee43 + e14d3bd commit 6858092
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/Repository/Searchable.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public static function buildQuery(Builder $query, array $condition)
} elseif (strtolower($type) === 'in') {
$query->whereIn($k, explode(',', $value));
} else {
if ($type === 'like') {
$value = str_replace(['\\', '%', '_'], ['\\\\', '\%', '\_'], $value);
}
$query->where($k, $type, $type === 'like' ? "%{$value}%" : $value);
}
}
Expand Down

0 comments on commit 6858092

Please sign in to comment.