I tried this:
$searchValues = explode(' ', $this->search);
$searchTermKeywords = array();
foreach ($searchValues as $word) {
$searchTermKeywords[] = " search_tags.name LIKE '%$word%'";
}
$results[0] = DB::table('search_tags')
->select('search_tags.name', 'product.*')
->join('product', 'search_tags.product_id','product.id')
->whereRaw(implode(' OR ', $searchTermKeywords))
->where([['product_quantity', '>', 0], ['active_status', '=' ,1]])
->groupBy('search_tags.product_id')
->paginate(10);
Error message:
SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'affiliate_new.search_tags.name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (SQL:
select count(*) as aggregate from (select `search_tags`.`name`, `product`.* from `search_tags` inner join `product` on `search_tags`.`product_id` = `product`.`id` where search_tags.name LIKE '%pen%' OR search_tags.name LIKE '%drive%' and (`product_quantity` > 0 and `active_status` = 1) group by `search_tags`.`product_id`) as `aggregate_table`
) (View: C:\Users...\Desktop\my_project\resources\views\result.blade.php)