1

In my project I am allowing user to search any thing. Recently facing an issue in Like query.

Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_unicode_ci,COERCIBLE) for operation 'like'

I got a solution for this issue but now want to convert in laravel query.

How I can write user.name LIKE _latin1 '%aaa‬%' COLLATE latin1_swedish_ci this in ->where() of laravel

and my current query code is $query->where('user.name', 'LIKE', '%'.$search.'%');

Alfiza malek
  • 994
  • 1
  • 14
  • 36

1 Answers1

1

You can use whereRaw like this

$query->whereRaw("user.name LIKE _latin1 '%aaa‬%' COLLATE latin1_swedish_ci");
sh1hab
  • 661
  • 5
  • 16