I use this Raw query to get some search results combining the header and tag columns. my code is as follows
$term="Test";
$clips= \Clip::whereRaw("caption like '%?%' OR tags like '%?%' ", array($term,$term))->get();
dd($clips);
but using this, I can’t get the results, because the dump doesn’t show the results, where, using the code below, I can get the results:
$term="Test";
$clips= \Clip::whereRaw("caption like '%$term%' OR tags like '%$term%' ")->get();
dd($clips);
and the dump shows all 5 results that are expected. What am I doing wrong in the first case.
source
share