Skip to content

Commit 0ad682f

Browse files
authored
Merge pull request #15267 from dododedodonl/fix-case-search-json
Fix forced lower case search for json field
2 parents cf5c208 + 215e662 commit 0ad682f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

packages/support/src/helpers.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ function generate_search_column_expression(string $column, ?bool $isSearchForced
181181
};
182182

183183
if ($isSearchForcedCaseInsensitive) {
184+
if (in_array($driverName, ['mysql', 'mariadb'], true) && str($column)->contains('->') && ! str($column)->startsWith('json_extract(')) {
185+
[$field, $path] = invade($databaseConnection->getQueryGrammar())->wrapJsonFieldAndPath($column); /** @phpstan-ignore-line */
186+
187+
$column = "json_extract({$field}{$path})";
188+
}
189+
184190
$column = "lower({$column})";
185191
}
186192

0 commit comments

Comments
 (0)