Try this :)
$query = User::query();
$keys = ['key1','key2','key3'];
foreach($keys as $key)
{
$query->where('search','LIKE','%'.$key.'%');
}
$query->take(5);
echo $query->toSql();
output:
select * from `users` where `search` LIKE ? and `search` LIKE ? and `search` LIKE ? limit 5
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community