I am using laravel 5.2 and I am trying to create search functionality where I am trying to query through multiple columns but I am not getting expected result.
I am using this query:
$wachat = Table::where('key', '=', $d1)
->orWhere('message', 'LIKE', "%{$searchByContact}%")
->orWhere('abc', 'LIKE', "%{$searchByContact}%")
->orWhere('xyz', 'LIKE', "%{$searchByContact}%")
->orderBy('id', 'DESC')->paginate(20);
I am getting results but here I want to filter everything where a key is anything. But with the aboove query, I am getting a result from all key is there anyway I can create a query and then just display result where a key is anything.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire