So currently I've created search text field to find keywords for specific columns of my database.
Using this eloquent
$data = DB::table('product')
->select('product.id','product.title','product.description','product.content','product.photo','product.quantity','product.price')
->join('product_per_category','product_per_category.product_id','=','product.id')
->where(['product.deleted' => 0])
->where(['product_per_category.deleted' => 0])
->where(['product_per_category.productcategory_id' => $id])
->where(function($query) use ($keyword){
$query->where('product.content', 'like', '%' . $keyword . '%')
->orWhere('product.title', 'like', '%' . $keyword . '%')
->orWhere('product.quantity', 'like', '%' . $keyword . '%')
->orWhere('product.price', 'like', '%' . $keyword . '%');
})
->groupBy('product.id')
->paginate(10);
If I try to search 234.00 value of Price all possible value that will match with the columns of content, title, quantity, price, quantity will automatically return the data.
How ever if I tried to search for a keyword like this
234.00 Books value of Price and Title. it will not return any data now. Because it will match only this sentence on specific columns.
What I'm trying to do is if I search something like this
= 234.00 Books 20
*Value of Price, Title and Quantity
It should return all the data that will match on every columns. Whether the letters lowercase or uppercase as long as it matches the position of letters
Is that possible?
** UPDATE **
Objective : Just want to match the 234 value on any columns. Be the result. But the problem of my query is, if I add another keyword like 234 Books it doesnt return any data