I am pretty new to laravel (started today) and facing a problem building a simple query:
$query->orWhere(\"CONCAT(`nvp`, \' \', `vpv`)\", \'LIKE\', \"%$th
Use orWhereRaw
to execute a raw where query:
$query->orWhereRaw("CONCAT(`nvp`, ' ', `vpv`) LIKE ?", ['%'.$this->searchNeedle.'%']);
Laravel does some stuff behind the scenes like adding in the tick marks for you.
Fortunately, it also offers a couple of tools to still get the job done for you...
For this type of thing, DB::raw()
usually works really well. Try something like this...
$query->orWhere(DB::raw("CONCAT(`nvp`, ' ', `vpv`)"), 'LIKE', "%".$this->searchNeedle."%");