Unclaimed project
Are you a maintainer of laravel-search-string? Claim this project to take control of your public changelog and roadmap.
Changelog
π Generates database queries based on one unique string
Add case_insensitive option for search queries β defaults to false for backward compatibility. (See #22)
You can set it to true in your options amongst columns and keywords. For example, in the config/search-string.php file:
return [
'default' => [
'case_insensitive' => true, // <- Globally.
// ...
],
Article::class => [
'case_insensitive' => true, // <- Only for the Article class.
// ...
],
];
When set to true, it will lowercase both the column and the value before comparing them using the like operator.
$value = mb_strtolower($value, 'UTF8');
$query->whereRaw("LOWER($column) LIKE ?", ["%$value%"]);