I am new to laravel (launched today) and am facing the challenge of creating a simple query:
$query->orWhere("CONCAT(`nvp`, ' ', `vpv`)", 'LIKE', "%$this->searchNeedle%");
This line above is one of several conditions in an encapsulated request condition. I think other lines are not needed for this case, but tell me if you need to see them.
I found out that the developer decided to add
`
before and after the first or Where / where param, which cause a problem that I cannot use a simple concat, because the line above will result in:
`CONCAT(`vpv`, ' ', `nvp`)` LIKE ?)' ↑ ↑ this & this
Since this is automatically added, I cannot delete it without overwriting the laravel-core function, which I will not use. Is there any SQL hack that handles these two `? Something like 1 = 1, you know?
Perhaps you have another solution to get the expected result by comparing one line with two lines in combination?
source share