I want to iterate through list of words broken down in a function processNeedle. This is working fine with ordinary php but not in laravel.
$query = $request->input('query');
$trim = new SearchTrim();
$words = $trim->ProcessNeedle($query);
$concat = "CONCAT(";
$concat.="title,";
$concat.="'')";
$sql =DB::select("SELECT DISTINCT id,title,code,abstract FROM projects WHERE 0 ";
foreach ($words as $word) $sql.=" OR $concat LIKE '%$word%'";
$sql.=" ORDER BY id DESC";
My query function well like this in php
SQL query: SELECT DISTINCT id,title,code FROM projects WHERE 0 OR CONCAT(title,'') LIKE '%intranet%' OR CONCAT(title,'') LIKE '%mailing%' ORDER BY id DESC;
How do i achieve this in Laravel Please help
''and whywhere 0?