It should work if a regular query works, this is a possible issue, check the issues and see if it's been brought up.
Oct 3, 2016
7
Level 1
Eloquent search LIKE with underscores wrong results
Hi, i have been searching for a long time now to resolve this, but i failed.... I want to realize a search by string, searching on specific columns in the database.
$response = \App\Migration::where('migration', 'LIKE', '%' . $search . '%')
->orWhere('batch', 'LIKE', '%' . $search . '%')
->paginate($pageSize);
$response->appends(['search' => $search])->links();
This does work, so far the search string does not contain any underscores (_). But the migration names do contain a lot of underscores...so i tried to send the same query via \DB::raw('select * from migrations where migration LIKE '%$search%');. But this does not work either...
When i execute a native query like SELECT * FROM migrations WHERE migration LIKE '%2016_%' everything works fine. I also tried to escape the underscores with no success...how can i solve this?
greetings from germany, Ole
Please or to participate in this conversation.