Skip to content

Commit 00562c6

Browse files
committed
Revert "Enable case-insensitive search in MySQL 8.7+ JSON fields"
This reverts commit 07fd050.
1 parent 0a058a4 commit 00562c6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/UniqueTranslationValidator.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,12 @@ protected function findTranslation($connection, $table, $column, $locale, $value
231231
{
232232
// Properly escape backslashes to work with LIKE queries...
233233
// See: https://stackoverflow.com/questions/14926386/how-to-search-for-slash-in-mysql-and-why-escaping-not-required-for-wher
234-
$value = str_replace('\\', '\\\\', $value);
234+
$value = str_replace('\\', '\\\\\\\\', $value);
235235

236236
return DB::connection($connection)->table($table)
237237
->where(function ($query) use ($column, $locale, $value) {
238-
$collation = $query->getConnection()->getConfig()['collation'];
239-
$query->whereRaw($column . '->"$.' . $locale . '" COLLATE ' . $collation . ' = ?', "\"{$value}\"");
238+
$query->where($column, 'LIKE', "%\"{$locale}\": \"{$value}\"%")
239+
->orWhere($column, 'LIKE', "%\"{$locale}\":\"{$value}\"%");
240240
});
241241
}
242242

0 commit comments

Comments
 (0)