Laravel concat in query (where condition)

后端 未结 2 502
梦如初夏
梦如初夏 2021-01-01 14:17

I am pretty new to laravel (started today) and facing a problem building a simple query:

$query->orWhere(\"CONCAT(`nvp`, \' \', `vpv`)\", \'LIKE\', \"%$th         


        
2条回答
  •  孤城傲影
    2021-01-01 14:44

    Use orWhereRaw to execute a raw where query:

    $query->orWhereRaw("CONCAT(`nvp`, ' ', `vpv`) LIKE ?", ['%'.$this->searchNeedle.'%']);
    

提交回复
热议问题