diff --git a/src/SearchableTrait.php b/src/SearchableTrait.php index 9b17734..472eb82 100644 --- a/src/SearchableTrait.php +++ b/src/SearchableTrait.php @@ -35,7 +35,8 @@ public function scopeSearch(Builder $q, $search, $threshold = null) { return $q; } - + + $search = strtolower($search); $words = explode(' ', $search); $selects = []; $this->search_bindings = []; @@ -234,7 +235,7 @@ protected function getSearchQuery(Builder $query, $column, $relevance, array $wo * @return string */ protected function getCaseCompare($column, $compare, $relevance) { - $field = $column . " " . $compare . " ?"; + $field = "LOWER(" . $column . ") " . $compare . " ?"; return '(case when ' . $field . ' then ' . $relevance . ' else 0 end)'; }