I am facing an issue in laravel 'like' query. I have a MIS on laravel with databases on MongoDb. Now my DB has a table named kw with urlencoded keywords like cars%20in%20London, Now my query gives accurate results for cars or cars%20in%20London but when I search cars%20in I get 0 results! This is how laravel 'like' is used in query but Mongo uses /.m./ form, How can I make this working. Here is my Model function
public static function selectKeywordIncomplete($keyword) {
$search_volume_incomplete = searchVolume::where('kw','like','%'.$keyword.'%')->orwhere('kw','=',$keyword)->where('status','=',1)->paginate(20);
return $search_volume_incomplete;
}
$search_volume_incomplete = searchVolume::where('kw','regex', new MongoRegex("/^$keyword/i"))->orwhere('kw','=',$keyword)->where('status','=',1)->paginate(20);?